summary refs log tree commit diff
path: root/src-slowcord/nginx/fosscord
blob: f1d53de162a82504a9f3c830ac02b1000a13e4df (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
server {
	server_name slowcord.understars.dev;

	client_max_body_size 150M;

	add_header Last-Modified $date_gmt;
	proxy_set_header Host $host;
	proxy_pass_request_headers on;
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header X-Forwarded-Proto https;
	proxy_set_header X-Forwarded-For $remote_addr;
	proxy_set_header X-Forwarded-Host $remote_addr;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "upgrade";

	location / {
		proxy_pass http://127.0.0.1:3001;
	}

	location /api {
		proxy_pass http://127.0.0.1:3001;
		add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';

		# TODO: This is a bad solution. Why does proxy_pass not forward all upstream errors to client?
		# Or is it just that the server is not actually responding?
		proxy_no_cache 1;
		proxy_cache_bypass 1;
		proxy_connect_timeout 1;
		proxy_send_timeout 1;
		proxy_read_timeout 1;
		send_timeout 1;
	}

	# TODO: Make the login service not suck
	location ~ ^/(login|register|oauth/discord|css/index.css|js/handler.js) {
		proxy_pass http://127.0.0.1:3010;
	}

	listen 443 ssl;
	ssl_certificate /etc/letsencrypt/live/slowcord.understars.dev/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/slowcord.understars.dev/privkey.pem;
	include /etc/letsencrypt/options-ssl-nginx.conf;
	ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}

server {
	if ($host = slowcord.understars.dev) {
		return 301 https://$host$request_uri;
	}

	listen 80;
	server_name slowcord.understars.dev;
	return 404;
}