Homepage without trailing slash broken (subfolder installation)



  • Hi guys,

    When I access my forum on http://127.0.0.1/forum/ (with trailing slash) it works great!
    But when i access my forum on http://127.0.0.1/forum (without trailing slash) it shows me this error:

    /forumcategories Not Found

    What can i do to fix it?
    I have this "url" in my config.json:
    "url": "http://127.0.0.1:4567/forum",

    And my apache have this proxy configuration on VirtualHost:

            ProxyRequests off
    
        <Proxy *>
            Order deny,allow
            Allow from all
        </Proxy>
    
        ProxyPass /forum http://127.0.0.1:4567/forum
        ProxyPassReverse /forum http://127.0.0.1:4567/forum
    
        ProxyPass /forum/ http://127.0.0.1:4567/forum/
        ProxyPassReverse /forum/ http://127.0.0.1:4567/forum/
    

    Tried a lot of things, but nothing seems to work.
    Anyone have a clue of how can I get this?


  • Admin

    Unfortunately I am unfamiliar with apache... does this stackoverflow article help? https://serverfault.com/questions/134183/how-to-reverse-proxy-with-or-without-trailing-slash



  • I run into the same issue with nginx without any Cloudfare rules set for the forum and without any CDN active, so the webserver serves content directly.

    Fix:

    NodeBB
    config.json

    There should be no forward slash at the end which complies with the documentation:

    "url": "https://blabla.com/forum",
    

    nginx.conf

    here note the double slash on the first line /forum/

    The double slash solves the issue, at least during initial testing on different browsers and devices.
    Not sure if this is a Windows/nginx specific thing as the path's are set a bit different.

    [...]
    location /forum/ {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;
    
            # proxy_pass http://127.0.0.1:4567;
            proxy_pass http://io_nodes;
    
            proxy_redirect off;
    
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
    	    }
    

 

Suggested Topics

| |