Skip to content

Commit b03bb42

Browse files
author
Joshua Rogers
authored
Create rewrite_with_return_fp.conf
1 parent 5511f56 commit b03bb42

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
location /1/ {
2+
rewrite ^ $request_uri; # Sets $1/$uri to raw path.
3+
rewrite ^/1(/.*) $1 break; # Extracts everything after /1 and places it into $1/$uri.
4+
return 400; # extremely important! # If rewrite rule does not break (e.g. //1/), return 400, otherwise the location-block will fall-through and proxy_pass will not actually happen at all.
5+
proxy_pass http://127.0.0.1:8080/$1; # $1 used, resulting in path being passed as the raw path from the original request.
6+
}
7+
8+
# Request received by nginx: /1/%2F
9+
# Request received by backend: /%2F (or possibly //%2F)

0 commit comments

Comments
 (0)