Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
NGINX: Redirect from current location into named location
# 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
You can’t perform that action at this time.