~sircmpwn/sr.ht-nginx

1844d6be9cbea7e69b724f20c555cd68e5111ea8 — Simon Ser 6 days ago 3e6d445 master
Add config for chat.sr.ht
1 files changed, 39 insertions(+), 0 deletions(-)

A chat.sr.ht.conf
A chat.sr.ht.conf => chat.sr.ht.conf +39 -0
@@ 0,0 1,39 @@
server {
	include sourcehut.conf;
	include port80.conf;
	server_name chat.sr.ht;
}

server {
	include sourcehut.conf;
	include port443.conf;
	include chat-ssl.conf;
	server_name chat.sr.ht;

	client_max_body_size 100M;

	location / {
		# TODO: find a nicer way to do this
		if ($http_cookie !~* "sr.ht.unified-login.v1") {
			return 302 https://meta.sr.ht/login?return_to=$scheme://$host$request_uri;
		}

		root /usr/share/webapps/gamja;
		add_header Content-Security-Policy "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline';" always;
		# TODO: setup caching
	}

	location /socket {
		proxy_pass http://127.0.0.1:8080;
		proxy_read_timeout 600s;
		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "Upgrade";
		include web.conf;
	}

	location /config.json {
		proxy_pass http://127.0.0.1:8080;
		include web.conf;
	}
}