Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

nginx: Redirect {www.,}zulipchat.com, www.zulip.com to zulip.com.

Anders Kaseorg723d285e4660
diff --git a/puppet/zulip_ops/files/nginx/sites-available/loadbalancer b/puppet/zulip_ops/files/nginx/sites-available/loadbalancer
index ffa26007268..50203c71eaf 100644
--- a/puppet/zulip_ops/files/nginx/sites-available/loadbalancer
+++ b/puppet/zulip_ops/files/nginx/sites-available/loadbalancer
@@ -19,6 +19,21 @@ server {
include /etc/nginx/zulip-include/certbot;
}
+server {
+ listen www.zulipstaging.com:443 http2;
+ server_name www.zulipstaging.com;
+
+ ssl on;
+ ssl_certificate /etc/letsencrypt/live/zulipchat.com/fullchain.pem;
+ ssl_certificate_key /etc/letsencrypt/live/zulipchat.com/privkey.pem;
+
+ location / {
+ return 301 https://zulipstaging.com$request_uri;
+ }
+
+ include /etc/nginx/zulip-include/certbot;
+}
+
server {
# The listen needs to be `www.zulipstaging.com` since bare zulipstaging.com
# is not a CNAME and thus has the public IP inside EC2
@@ -51,36 +66,32 @@ server {
server {
# The listen needs to be `www.zulipchat.com` since bare zulipchat.com
# is not a CNAME and thus has the public IP inside EC2
- listen www.zulipchat.com:443 default_server http2;
- server_name zulipchat.com *.zulipchat.com;
+ listen www.zulipchat.com:443 http2;
+ server_name www.zulipchat.com zulipchat.com www.zulip.com;
ssl on;
ssl_certificate /etc/letsencrypt/live/zulipchat.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/zulipchat.com/privkey.pem;
location / {
- proxy_pass https://prod;
- include /etc/nginx/zulip-include/proxy;
+ return 301 https://zulip.com$request_uri;
}
- location /json/events {
+ location /static {
+ # The app loads static files from https://zulipchat.com/static,
+ # so skip the redirect for those.
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;
+ include /etc/nginx/zulip-include/proxy;
}
include /etc/nginx/zulip-include/certbot;
}
server {
- # The listen needs to be `www.zulip.com` since bare zulip.com
+ # The listen needs to be `www.zulipchat.com` since bare zulipchat.com
# is not a CNAME and thus has the public IP inside EC2
- listen www.zulip.com:443 http2;
- server_name zulip.com *.zulip.com;
+ listen www.zulipchat.com:443 default_server http2;
+ server_name *.zulipchat.com zulip.com *.zulip.com;
ssl on;
ssl_certificate /etc/letsencrypt/live/zulipchat.com/fullchain.pem;