Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Last active January 19, 2021 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miguelmota/93af3f38de440813b29fa40e44cb8a5d to your computer and use it in GitHub Desktop.
Save miguelmota/93af3f38de440813b29fa40e44cb8a5d to your computer and use it in GitHub Desktop.
NGINX rewrite with no redirect by using proxy_pass and use custom path
if ($http_user_agent ~* 'curl') {
rewrite ^(.*)$ /curl_rewrite/$1;
}
location /curl_rewrite/ {
rewrite ^/curl_rewrite/(.*)$ /some-path/$1?$query_string break;
proxy_pass http://localhost:8080;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment