-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault
55 lines (44 loc) · 1.64 KB
/
default
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
server {
listen 80 default_server;
listen [::]:80 default_server;
server_tokens off;
# Change these to your domain
server_name allo.guru www.allo.guru;
# Limit Request Sizes
client_max_body_size 10M;
# Buffer Overflow Protections
client_body_buffer_size 128k;
client_header_buffer_size 1k;
large_client_header_buffers 4 4k;
# XSS Protection
add_header X-XSS-Protection "1; mode=block";
# Timeouts
client_body_timeout 12;
client_header_timeout 12;
keepalive_timeout 15;
# Proxy requests to Next.js server
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# Proxy requests to Flask API and handle CORS
location /api/ {
proxy_pass http://localhost:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# CORS headers
if ($http_origin ~* (http://localhost:3000)) {
add_header 'Access-Control-Allow-Origin' "$http_origin";
}
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
}
}