diff options
| author | Matthew Fennell <matthew@fennell.dev> | 2026-01-03 14:27:07 +0000 |
|---|---|---|
| committer | Matthew Fennell <matthew@fennell.dev> | 2026-01-03 14:27:07 +0000 |
| commit | 5aebdf5c72549adc87189021fd996269558e0543 (patch) | |
| tree | c06280312bb4d113e9038b077d7ec56d5f0e11b2 /files/nginx_conf.j2 | |
| parent | 770db24aeec0d85cae8c0357c5a13468e8478cac (diff) | |
Serve invite pages under virtual host
While ensuring that all hosts are deployed to the chat subdomain, I applied the
same logic to the invite pages too.
However, this broke invites as prosody's HTTP module has a check which ensures
that the page being served is on the same domain as the virtual host, meaning
that invite pages hosted under the chat subdomain would receive a 404.
So, serve invite pages from the domain itself (which is the default config in
prosody). To do this, we must direct such requests from nginx too.
Diffstat (limited to 'files/nginx_conf.j2')
| -rw-r--r-- | files/nginx_conf.j2 | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/files/nginx_conf.j2 b/files/nginx_conf.j2 index 3630f78..29cd59d 100644 --- a/files/nginx_conf.j2 +++ b/files/nginx_conf.j2 @@ -29,3 +29,31 @@ server { return 301 https://$host$request_uri; } + +server { + listen 443 ssl; + listen [::]:443 ssl; + + ssl_certificate /etc/prosody/certs/{{ virtual_host }}.crt; + ssl_certificate_key /etc/prosody/certs/{{ virtual_host }}.key; + + server_name {{ virtual_host }}; + + location / { + proxy_pass https://localhost:5281; + proxy_set_header Host "{{ virtual_host }}"; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_buffering off; + tcp_nodelay on; + } +} + +server { + listen 80; + listen [::]:80; + + server_name {{ virtual_host }}; + + return 301 https://$host$request_uri; +} |
