Created
November 6, 2013 07:03
-
-
Save ilguzin/7332082 to your computer and use it in GitHub Desktop.
NGINX: Redirect from current location into named location
This file contains hidden or 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
# Use only codes greater than 418, do not use common status codes 404, 402, 403, etc | |
location /js { | |
error_page 418 = @backend; return 418; | |
} | |
location /data { | |
error_page 418 = @backend; return 418; | |
} | |
location @backend { | |
rewrite ^/(.+)$ /backend-url-prefix/$1 break; | |
proxy_pass http://127.0.0.1:82; | |
proxy_redirect off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment