nginx: Replace unanchored regexes in location directives.

We could anchor the regexes, but there’s no need for the power (and
responsibility) of regexes here.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-04-24 16:00:33 -07:00 committed by Tim Abbott
parent b29c44ed94
commit c0ffa71fa9
2 changed files with 25 additions and 5 deletions

View File

@ -17,7 +17,7 @@ location /static/ {
}
# Send longpoll requests to Tornado
location ~ /json/events {
location /json/events {
proxy_pass http://tornado;
include /etc/nginx/zulip-include/proxy_longpolling;

View File

@ -35,7 +35,12 @@ server {
}
# We don't need /api/v1/events/internal, because that doesn't go through the loadbalancer.
location ~ /json/events|/api/v1/events {
location /json/events {
proxy_pass https://staging;
include /etc/nginx/zulip-include/proxy_longpolling;
}
location /api/v1/events {
proxy_pass https://staging;
include /etc/nginx/zulip-include/proxy_longpolling;
}
@ -58,7 +63,12 @@ server {
include /etc/nginx/zulip-include/proxy;
}
location ~ /json/events|/api/v1/events {
location /json/events {
proxy_pass https://prod;
include /etc/nginx/zulip-include/proxy_longpolling;
}
location /api/v1/events {
proxy_pass https://prod;
include /etc/nginx/zulip-include/proxy_longpolling;
}
@ -81,7 +91,12 @@ server {
include /etc/nginx/zulip-include/proxy;
}
location ~ /json/events|/api/v1/events {
location /json/events {
proxy_pass https://prod;
include /etc/nginx/zulip-include/proxy_longpolling;
}
location /api/v1/events {
proxy_pass https://prod;
include /etc/nginx/zulip-include/proxy_longpolling;
}
@ -100,7 +115,12 @@ server {
include /etc/nginx/zulip-include/proxy;
}
location ~ /json/events|/api/v1/events {
location /json/events {
proxy_pass https://prod;
include /etc/nginx/zulip-include/proxy_longpolling;
}
location /api/v1/events {
proxy_pass https://prod;
include /etc/nginx/zulip-include/proxy_longpolling;
}