Improve comments for clarity
This commit is contained in:
parent
214efca62c
commit
cf3a3bc4b9
1 changed files with 8 additions and 3 deletions
|
@ -13,16 +13,21 @@
|
||||||
{% assign forward_path_end_char = forward_path | slice: -1 %}
|
{% assign forward_path_end_char = forward_path | slice: -1 %}
|
||||||
{% if location_path_end_char == "/" and forward_path_end_char != "/" %}
|
{% if location_path_end_char == "/" and forward_path_end_char != "/" %}
|
||||||
if ($request_uri ~ "{{ path }}(.*$)") {
|
if ($request_uri ~ "{{ path }}(.*$)") {
|
||||||
# Location path ends with / but forward path doesn't, so we prefix $path_remainder with a slash.
|
# Location path ends with / so the regex match will exclude that slash from the match,
|
||||||
|
# but forward path doesn't, so we must prefix $path_remainder with a slash.
|
||||||
set $uri_remainder /$1;
|
set $uri_remainder /$1;
|
||||||
}
|
}
|
||||||
{% elsif location_path_end_char != "/" and forward_path_end_char == "/" %}
|
{% elsif location_path_end_char != "/" and forward_path_end_char == "/" %}
|
||||||
# Location path does not have a trailing / but forward path does, so we make sure to capture $uri_remainder without a leading slash.
|
# Location path does not have a trailing / but forward path does,
|
||||||
|
# so we make sure to capture $uri_remainder without a leading slash.
|
||||||
if ($request_uri ~ "{{ path }}/(.*$)") {
|
if ($request_uri ~ "{{ path }}/(.*$)") {
|
||||||
set $uri_remainder $1;
|
set $uri_remainder $1;
|
||||||
}
|
}
|
||||||
{% else %}
|
{% else %}
|
||||||
# Either both location path and forward path have a trailing /, or neither do, so we make sure to capture $uri_remainder with a leading slash (if it has one).
|
# Either both location path and forward path have a trailing /, or neither do.
|
||||||
|
# If both do, then we need to capture $uri_remainder without a leading /, but if neither do,
|
||||||
|
# then we need to capture $uri_remainder with a leading slash (if it has one - it could just be some GET parameters).
|
||||||
|
# The code for both scenarios happens to be the same.
|
||||||
if ($request_uri ~ "{{ path }}(.*$)") {
|
if ($request_uri ~ "{{ path }}(.*$)") {
|
||||||
set $uri_remainder $1;
|
set $uri_remainder $1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue