Browse Source

prevent out redirects #2

main
ghost 7 months ago
parent
commit
b48f39da4c
  1. 5
      nginx/opennet/locations.conf
  2. 9
      nginx/opennet/locations/handle/redirect.conf
  3. 4
      nginx/opennet/locations/include/common.conf

5
nginx/opennet/locations.conf

@ -35,4 +35,7 @@ include /etc/nginx/opennet/locations/solaris.conf; @@ -35,4 +35,7 @@ include /etc/nginx/opennet/locations/solaris.conf;
include /etc/nginx/opennet/locations/web.conf;
# wiki
include /etc/nginx/opennet/locations/wiki.conf;
include /etc/nginx/opennet/locations/wiki.conf;
# handles (do not delete)
include /etc/nginx/opennet/locations/handle/redirect.conf;

9
nginx/opennet/locations/handle/redirect.conf

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
# Prevent out redirects (solution for issue #2)
location @opennet_locations_handle_redirect {
set $original_uri $uri;
set $orig_loc $upstream_http_location;
proxy_pass $orig_loc;
}

4
nginx/opennet/locations/include/common.conf

@ -6,6 +6,10 @@ @@ -6,6 +6,10 @@
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
# Prevent out redirects (issue #2)
proxy_intercept_errors on;
error_page 301 302 307 = @opennet_locations_handle_redirect;
# Replace all matches
sub_filter_once off;

Loading…
Cancel
Save