-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
58 lines (58 loc) · 2.83 KB
/
nginx.conf
File metadata and controls
58 lines (58 loc) · 2.83 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
events {}
http {
# Doc :
# Permet de maper sur les différentes URL et de définir les méthodes utilisées
# La requête OPTION (pre-flight) est envoyé avant la requête, afin de déterminer si c'est sécurisé d'envoyer cette dernière ou non
map '$request_method $http_origin' $allow_cors {
'~^OPTIONS http://localhost:7000' OPTIONS;
'~^OPTIONS https://staging.092024-bleu-1.wns.wilders.dev' OPTIONS;
'~^OPTIONS https://092024-bleu-1.wns.wilders.dev' OPTIONS;
'~^OPTIONS https://ops.092024-bleu-1.wns.wilders.dev' OPTIONS;
'~^(GET|POST|DELETE) http://localhost:7000' GET|POST|DELETE;
'~^(GET|POST|DELETE) https://staging.092024-bleu-1.wns.wilders.dev' GET|POST|DELETE;
'~^(GET|POST|DELETE) https://092024-bleu-1.wns.wilders.dev' GET|POST|DELETE;
'~^(GET|POST|DELETE) https://ops.092024-bleu-1.wns.wilders.dev' GET|POST|DELETE;
default 0;
}
server {
listen 80;
location /api {
proxy_hide_header 'Access-Control-Allow-Origin';
if ($allow_cors = OPTIONS) {
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Access-Control-Allow-Origin#cors_and_caching
add_header 'Vary' 'Origin' always;
add_header 'Access-Control-Allow-Origin' $http_origin;
add_header 'Access-Control-Allow-Methods' 'GET, POST, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
# Dis au client que l'info pre-flight est valide pendant 20 jours
add_header 'Access-Control-Max-Age' 86400;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
if ($allow_cors = GET|POST|DELETE) {
add_header 'Vary' 'Origin' always;
add_header 'Access-Control-Allow-Origin' $http_origin always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
}
proxy_pass http://backend:4000/;
}
location /adminer {
proxy_pass http://adminer:8080;
}
location /hmr {
proxy_pass http://frontend:5173;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
proxy_pass http://frontend:5173;
}
location /img {
proxy_pass http://img:4000;
}
}
}