You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.3 KiB
44 lines
1.3 KiB
server {
|
|
server_name localhost;
|
|
listen 80;
|
|
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
server {
|
|
server_name localhost;
|
|
listen 443 ssl;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html index.htm;
|
|
|
|
ssl_certificate /etc/nginx/ssl/nginx-selfsigned.crt;
|
|
ssl_certificate_key /etc/nginx/ssl/nginx-selfsigned.key;
|
|
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
|
|
# API routes - proxy to backend (MUST come before static file rules)
|
|
location /api/ {
|
|
proxy_pass http://resit_backend:8000;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_buffering off;
|
|
}
|
|
|
|
# Static assets - NO CACHING for development
|
|
location ~* ^/(?!api/).*\.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
|
|
add_header Pragma "no-cache";
|
|
add_header Expires "0";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# Handle React Router - all other routes should serve index.html
|
|
location / {
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|