Last active
April 11, 2018 03:18
-
-
Save imerr/7fb5ca8a03f7d81838be0f641bc5c956 to your computer and use it in GitHub Desktop.
reverse download nginx proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server{ | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
allow 1.2.3.4; # whitelist server | |
deny all; | |
location / { | |
return 403; | |
} | |
location ~/i/(?<rdomain>[a-zA-Z0-9-\.]+)/ { | |
rewrite /i/([a-zA-Z0-9-\.]+)/(.*) /$2 break; | |
proxy_http_version 1.1; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $rdomain; | |
proxy_buffering off; | |
proxy_pass http://$rdomain; | |
} | |
location ~/s/(?<rdomain>[a-zA-Z0-9-\.]+)/ { | |
rewrite /s/([a-zA-Z0-9-\.]+)/(.*) /$2 break; | |
proxy_http_version 1.1; | |
proxy_buffering off; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $rdomain; | |
proxy_pass https://$rdomain; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment