1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.5 Full Friendly URLs Issue

Discussion in 'Troubleshooting and Problems' started by Mayhem30, Jan 8, 2016.

  1. Mayhem30

    Mayhem30 New Member

    I'm having issues getting "Full Friendly URLs" working.

    When enabled, this is what Firefox is showing (same thing happens in all browsers) :

    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

    This webpage has a redirect loop

    ERR_TOO_MANY_REDIRECTS

    ----

    This is what my logs are showing when I attempt to log in :

    [08/Jan/2016:13:25:57 -0800] "POST /index.php?/login/login& HTTP/1.0" 303 - "http://example.com/" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0"

    [08/Jan/2016:13:25:57 -0800] "GET /index.php HTTP/1.0" 301 - "http://example.com/" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0"
    [08/Jan/2016:13:25:57 -0800] "GET /index.php HTTP/1.0" 301 - "http://example.com/" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0"
    [08/Jan/2016:13:25:57 -0800] "GET /index.php HTTP/1.0" 301 - "http://example.com/" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0"


    This is what I am using in Nginx to handle the requests :

    location / {
    try_files $uri $uri/ /index.php?$uri&$args;
    index index.php index.html;
    }

    # Pass off php requests to Apache
    location ~* \.php$ {
    try_files $uri =404;

    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    proxy_connect_timeout 60s;
    proxy_send_timeout 60s;
    proxy_read_timeout 60s;

    # buffers used for reading a response from the proxied server
    proxy_buffers 8 24k;

    # size of the buffer size used for reading the response headers from apache
    proxy_buffer_size 4k;

    proxy_busy_buffers_size 64k;
    proxy_temp_file_write_size 64k;

    proxy_pass http://127.0.0.1:80;
    }

    Any ideas what I am missing?
     
  2. Tracy Perry

    Tracy Perry Well-Known Member

    You running nginx as a proxy to Apache? If so, then you need to use the .htaccess for the FURLS... nginx doesn't handle them.
     
  3. Mayhem30

    Mayhem30 New Member

    Looking at the .htaccess file, it doesn't appear to handle them either.

    Do you know which line(s) below handles the FURLS?

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]

    Also, I'm assuming the Nginx config also needs to be changed? Would anyone here know what those changes would be?

    I see this site is using FURLS on Nginx with no issues.
     
  4. Tracy Perry

    Tracy Perry Well-Known Member

    Unless you are doing something unusual, all you typically need to do is rename/copy the htaccess.txt in the forum directory to .htaccess. By default it should work (in most cases) to allow FURL's if you are using Apache or LiteSpeed as your primary HTTP server.

    You haven't been clear on that.. are you using nginx as a proxy? If so, then it doesn't handle the FURL's.. apache should be doing that.

    As am I on my 2 XF sites, my WBB site, the IPS site when I had it up running, and the 4 WordPress sites.... but I (and I'm sure here they are also) are allowing nginx to handle ALL processing - not perform as a proxy. First you need to answer whether you are using it as a proxy or not.
     
  5. Mayhem30

    Mayhem30 New Member

    Sorry, I have it setup where Nginx handles all incoming requests - and only passes .php file requests off to Apache.

    The .htaccess file is there and I have "AllowOverride" set to "All" in the apache vhosts.

    However, with all that setup, the forum still gets stuck in an infinite redirect loop hammering the index.php file.

    The forum is installed in the root directory.
     
  6. Tracy Perry

    Tracy Perry Well-Known Member

    Looks like set up a reverse proxy then.. never messed with that configuration so I'll have to leave it to someone else. Sorry.
     
  7. Mayhem30

    Mayhem30 New Member

    Ok, I managed to solve the issue by removing directory requests ( $uri/ ) from the "try_files" directive.

    The issue is that Nginx is trying to serve (eg) https://xenforo.com/community/threads/full-friendly-urls-issue.110779/ as a directory as gets stuck in infinite redirect loop.

    If you use Nginx in front of Apache, you must do this in order for it to work :

    try_files $uri /index.php?uri&$args @backend;

    # Pass off php requests to Apache
    location ~ \.php$ {
    try_files $uri =404;
    include /nginx/proxypass.conf;
    proxy_pass http://127.0.0.1:80;
    }

    location @backend {
    include /nginx/proxypass.conf;
    proxy_pass http://127.0.0.1:80;
    }

    If the request can't be fulfilled either directly ($uri) or with index.php, pass the request to Apache (@backend) and it will now read the .htaccess file and handle the request properly.
     
    Tracy Perry likes this.

Share This Page