We used nginx to configure our node js project. Everything works fine until we add ssl. After that, it blocks POST requests with "application/x-www-form-urlencoded" content-type and rewrites it to GET.
My config:
server {
listen 80;
listen [::]:80;
server_name domain.online www.domain.online;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name domain.online www.domain.online;
# SSL certificate paths
ssl_certificate /etc/ssl/private/letsencrypt-domain.pem;
ssl_certificate_key /etc/ssl/private/letsencrypt-domain.key;
# SSL configuration
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers 'TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384';
# Enable OCSP stapling
ssl_stapling on;
ssl_stapling_verify on;
# Set the path to your certificate's CA bundle
#ssl_trusted_certificate /path/to/your/CA_bundle.pem;
# Enable HSTS (optional but recommended)
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
location / {
proxy_pass http://127.0.0.1:8080; # Adjust this to your backend app's address and port
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_set_header X-Frame-Options SAMEORIGIN;
proxy_set_header X-Content-Type-Options nosniff;
proxy_set_header X-XSS-Protection "1; mode=block";
}
}
I removed the ssl certificate and replaced it with a new one but it didn't work.