feat(prod): production deployment fixes - env loader, mongoose module, CSS static files, security hardening, PDF export, new UI components
This commit is contained in:
1 parent
a403f752f3
commit
46f33eb088
69 files changed
+7367
-744
No files matched your search
@@ -1,8 +1,14 @@
|
||||
limit_req_zone $binary_remote_addr zone=api:10m rate=30r/s;
|
||||
limit_req_zone $binary_remote_addr zone=uploads:10m rate=5r/s;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name demoplace.my.id;
|
||||
|
||||
server_tokens off; # Hide NGINX version
|
||||
server_name demoplace.my.id www.demoplace.my.id;
|
||||
|
||||
server_tokens off;
|
||||
|
||||
# Allow large file uploads for profile pictures (max 10MB)
|
||||
client_max_body_size 10m;
|
||||
|
||||
# Security Headers
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
@@ -10,12 +16,12 @@ server {
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
||||
add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline' 'unsafe-eval';" always;
|
||||
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
|
||||
|
||||
# Rate Limiting zone configuration should be in nginx.conf (http block), but we can configure basic protection
|
||||
# We will pass everything to the frontend container
|
||||
|
||||
location / {
|
||||
proxy_pass http://frontend:3000;
|
||||
# Rate limiting on API endpoints
|
||||
location /api/auth/ {
|
||||
limit_req zone=api burst=20 nodelay;
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
@@ -24,8 +30,37 @@ server {
|
||||
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_hide_header X-Powered-By;
|
||||
proxy_read_timeout 30s;
|
||||
}
|
||||
|
||||
# Hide internal technologies from being sent back to the client
|
||||
# Profile picture uploads — rate limited more strictly
|
||||
location /api/auth/upload-profile-picture {
|
||||
limit_req zone=uploads burst=5 nodelay;
|
||||
client_max_body_size 10m;
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
proxy_http_version 1.1;
|
||||
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_read_timeout 60s;
|
||||
proxy_hide_header X-Powered-By;
|
||||
}
|
||||
|
||||
# All other traffic goes to Next.js frontend
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1: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_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_hide_header X-Powered-By;
|
||||
proxy_read_timeout 30s;
|
||||
proxy_connect_timeout 10s;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user