Repository navigation
Expand file tree
/
Copy pathnginx.web.conf
More file actions
111 lines (89 loc) · 2.75 KB
/
Copy pathnginx.web.conf
File metadata and controls
111 lines (89 loc) · 2.75 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
map $http_x_forwarded_for $spliit_forwarded_for {
default $http_x_forwarded_for;
'' $remote_addr;
}
map $http_x_real_ip $spliit_real_ip {
default $http_x_real_ip;
'' $remote_addr;
}
map $http_x_forwarded_proto $spliit_forwarded_proto {
default $http_x_forwarded_proto;
'' $scheme;
}
map $http_host $spliit_forwarded_host {
default $http_host;
'' $host;
}
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# The Docker deployment is same-origin by default. Keep the API private on
# the Compose network and forward only its public route surface through this
# web container.
proxy_http_version 1.1;
proxy_set_header Host $spliit_forwarded_host;
# The published port binds to loopback by default, so the host reverse proxy
# is the trusted edge. Preserve the client identity and public scheme it
# supplies; fall back to this connection for direct/local requests.
proxy_set_header X-Real-IP $spliit_real_ip;
proxy_set_header X-Forwarded-For $spliit_forwarded_for;
proxy_set_header X-Forwarded-Host $spliit_forwarded_host;
proxy_set_header X-Forwarded-Proto $spliit_forwarded_proto;
# These are SPA pages, not Better Auth endpoints. Exact matches take
# precedence over the API proxy below so refreshes and emailed redirects
# continue to serve index.html.
location = /auth/forgot-password {
try_files $uri /index.html;
}
location = /auth/reset-password {
try_files $uri /index.html;
}
location = /auth/complete-profile {
try_files $uri /index.html;
}
location ~ ^/(trpc|auth)(/|$) {
proxy_buffering off;
proxy_pass http://api:3001;
}
location ^~ /.well-known/ {
proxy_buffering off;
proxy_pass http://api:3001;
}
location ~ ^/health(/|$) {
proxy_pass http://api:3001;
}
location = /email/unsubscribe {
proxy_pass http://api:3001;
}
location ~ ^/groups/[^/]+/expenses/export/(json|csv)$ {
proxy_pass http://api:3001;
}
location = /openapi.json {
proxy_pass http://api:3001;
}
location = /docs {
proxy_pass http://api:3001;
}
location /assets/ {
try_files $uri =404;
add_header Cache-Control "public, max-age=31536000, immutable" always;
}
location = /index.html {
add_header Cache-Control "no-cache, max-age=0, must-revalidate" always;
}
location = /sw.js {
add_header Cache-Control "no-cache, max-age=0, must-revalidate" always;
}
location = /registerSW.js {
add_header Cache-Control "no-cache, max-age=0, must-revalidate" always;
}
location = /manifest.webmanifest {
add_header Cache-Control "no-cache, max-age=0, must-revalidate" always;
}
location / {
add_header Cache-Control "no-cache, max-age=0, must-revalidate" always;
try_files $uri $uri/ /index.html;
}
}