So i have a strange configuration that i need until i get to refactor a project later this year.
it is a static index.html landing page served with a location root "/" by NGINX.
i have a slash location like so:
location /channel/ {
proxy_pass http://node_server:5000/;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Ssl on;
proxy_cache_bypass $http_upgrade;
}
that express.js then handles. Express just serves a static folder with auto-generated content that a user can then navigate around in.
It works well in the sense that any appending slashes like:
/channel/open/
but ONLY if i have a trailing slash after "open". If i leave it out then NGINX will throw a "404 Not Found", if i keep it in, it works as intended.
The thing is that a user should be able to click on a folder in the static served directory to traverse a file structure, and the way that works in a browser is that it does not append a trailing slash to a directory name when clicked, so NGINX then throws the "404".I have tried a NPM package called 'express-slash' but that did not solve the issue.
i was hoping someone here had some suggestions on what i could try out next?
Details about trailing slash behavior can be found here: https://serverfault.com/questions/607615/using-trailing-slashes-in-nginx-configuration
But if your goal is to configure NGINX to allow directory traversal, you may be looking for the autoindex
directive: http://nginx.org/en/docs/http/ngx_http_autoindex_module.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.