Files
infrastructure/roles/hedgedoc/templates/nginx.d.conf.j2
Mark HegrebergandChristian Heusel 410f59cb5a apply http_redirect role to our nginx
these are all the systems that the new redirect snippet can be cleanly
applied to. there are a few others not included, that will need a more
manual approach:
 - gitlab (multiple domains)
 - mta.sts(multiple domains)
 - archweb(mutltiple domains, snippets)
 - buildbtw(dynamic dev domains)
 - redirects(different structure)
 - public html(multiple domains)
 - archweb maintenence(different structure)
 - maintenence(different structure)

some of these might be solvable by tweaking the snippet to accept
multiple domains. I'll look into this

Co-authored-by: Christian Heusel <christian@heusel.eu>
2026-03-04 00:52:19 +01:00

53 lines
1.3 KiB
Django/Jinja

upstream hedgedoc {
server localhost:3000;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
include snippets/redirect-80.conf;
server {
include snippets/listen-443.conf;
server_name {{ hedgedoc_domain }};
access_log /var/log/nginx/{{ hedgedoc_domain }}/access.log main;
access_log /var/log/nginx/{{ hedgedoc_domain }}/access.log.json json_main;
error_log /var/log/nginx/{{ hedgedoc_domain }}/error.log;
acme_certificate letsencrypt;
ssl_certificate $acme_certificate;
ssl_certificate_key $acme_certificate_key;
{% set proxy -%}
proxy_pass http://hedgedoc;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
{%- endset %}
location / {
{{ proxy }}
}
location = /status {
return 403;
}
location = /metrics {
if ($http_authorization != "Bearer {{ vault_hedgedoc_metrics_token }}") {
return 403;
}
{{ proxy }}
}
location /socket.io/ {
{{ proxy }}
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}