weather_api/config/nginx.local_http.conf
Argiris Deligiannidis ec9ae3afb3
All checks were successful
continuous-integration/drone/push Build is passing
add nginx configs
2024-04-14 23:21:43 +03:00

49 lines
2.3 KiB
Plaintext

server {
listen 8880;
listen [::]:8880;
proxy_read_timeout 1000s;
proxy_connect_timeout 1000s;
proxy_send_timeout 1000s;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
# log
access_log /var/log/nginx/api-karakatsanis.access.log;
error_log /var/log/nginx/api-karakatsanis.error.log;
# common gzip
gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
gzip on;
location / {
proxy_hide_header 'access-control-allow-origin';
if ($http_origin ~* "^https?://(localhost|localhost:3030|localhost:8880|localhost:8880|localhost:8888|localhost:3000|127.0.0.1|127.0.0.1:8880|127.0.0.1:8880|127.0.0.1:8888|127.0.0.1:3000|10.1.1.1|10.1.1.1:8880|10.1.1.1:8880|10.1.1.1:8888|10.1.1.1:3000|10.1.1.2|10.1.1.2:8880|10.1.1.2:8880|10.1.1.2:8888|10.1.1.2:3000|10.1.1.3|10.1.1.3:8880|10.1.1.3:8880|10.1.1.3:8888|10.1.1.3:3000|10.1.1.3:3030|192.168.1.100)$") {
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always;
}
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always;
return 204;
}
proxy_pass http://localhost:8888;
#proxy_http_version 1.1;
#proxy_set_header X-Forwarded-Proto $scheme;
#proxy_set_header Host $host;
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}