Skip to content

Commit 5511f56

Browse files
author
Joshua Rogers
authored
Create rewrite_with_return.conf
1 parent 992ecc7 commit 5511f56

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
4+
return 400; # extremely important! # If rewrite rule does not break (e.g. //1/), return 400, otherwise the location-block will fall-through.
5+
proxy_pass http://127.0.0.1:8080; # No $1 or $uri or other variable, resulting in path being double-encoded
6+
}
7+
8+
# Request received by nginx: /1/%2F
9+
# Request received by backend: /%252F (or possibly //%252F)

0 commit comments

Comments
 (0)