diff --git a/Docker/nginx/template.conf b/Docker/nginx/template.conf index 1e8de864..4345e4d4 100644 --- a/Docker/nginx/template.conf +++ b/Docker/nginx/template.conf @@ -5,11 +5,16 @@ upstream frappe-bench-frappe { upstream frappe-bench-socketio-server { server socketio:80 fail_timeout=120; } + +log_format prod_log '{"Request":"$request","Status":"$status","Request_URI":"$request_uri","Host":"$host","Client_IP":"$remote_addr","Proxy_IP(s)":"$proxy_add_x_forwarded_for","Proxy_Hostname":"$proxy_host","Real_IP":"$http_x_real_ip","User_Client":"$http_user_agent","TimeTaken":"$request_time","ContentType":"$content_type"}'; + server { listen 80; listen [::]:80; + access_log /cscdscds prod_log; # TODO(alok)!: need to see what location to use + server_name {{ ' '.join(SITENAME.split(',')) }}; root /workspace/frappe-bench/sites; @@ -23,6 +28,11 @@ server { add_header X-XSS-Protection "1; mode=block"; add_header Referrer-Policy "same-origin, strict-origin-when-cross-origin"; + proxy_hide_header X-Powered-By; + proxy_hide_header X-Forwarded-Host; + + server_tokens off; + etag off; location /assets { try_files $uri =404; @@ -35,6 +45,11 @@ server { location /socket.io { proxy_http_version 1.1; + + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Frappe-Site-Name $host; @@ -48,7 +63,6 @@ server { } location / { - rewrite ^(.+)/$ $1 permanent; rewrite ^(.+)/index\.html$ $1 permanent; rewrite ^(.+)\.html$ $1 permanent;