NgInx & NodeJs deployment Getting Response Code 418

  Kiến thức lập trình

I create Application in NodeJS, EJS and deployed on Ec2 with Nginx. I used default nginx configuration for deployment. every thing is working properly but, while testing on facebook debug tool I am getting 418 response code error

enter image description here

Because of this response code Meta tag is not loading.

I tried changed configuration but it’s coludn’t work

nginx config file:

server {
     listen 80 default_server;
     listen [::]:80 default_server;
     return 301 https://$host$request_uri; 
} 
server {     
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;
    ssl_certificate **path**;
    ssl_certificate_key /etc/ssl/private/****.key;
    server_name default_server;
    # Replace with your actual domain or IP
    location / {         
    proxy_pass http://localhost:4000/;         
    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;
    }     
    # Additional SSL settings for better security
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers off;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    add_header Strict-Transport-Security "max-age=31536000" always;
    add_header X-Content-Type-Options nosniff;
    add_header X-Frame-Options SAMEORIGIN;
    add_header X-XSS-Protection "1; mode=block"; 
}

2

LEAVE A COMMENT