Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible issue when running vascan_and_tools_playbook with port forwarding #4

Open
cgendreau opened this issue Jun 22, 2018 · 0 comments

Comments

@cgendreau
Copy link
Contributor

This issue is mostly to capture documentation about a specific issue with my development setup and the nginx configuration.

Setup:
VirtualBox Port Forwarding Host 8082 <-> Guest 80.

When accessing the static assets the following behaviour is observed:

http://localhost:8082/sitemap/test.txt -> HTTP 200 OK (test.txt was created for testing purpose)
http://localhost:8082/sitemap/ -> HTTP 403 Forbidden (that's ok, directory listing is disabled)
http://localhost:8082/sitemap -> HTTP 301 Moved Permanently Location: http://localhost/sitemap/

Nginx will automatically try a redirect to a resource with a trailing slash if no resource was found without the trailing slash. The behaviour is fine except that the port is missing from the redirect.

I was able to fix the issue locally by using a configuration similar to:

location ~ ^(\/sitemap|\/downloads)$ {
   return 301 $scheme://$http_host$uri/;
}

The idea is to build the redirect url with $http_host. We also want to restrict the redirect to known assets (sitemap, downloads ...) to avoid applying it to app (e.g. vascan).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant