Question call throwing 400 Bad Request for some users

Hi, We have hosted the Nodejs application using nginx as webserver with digicert ssl mapped to it.

user www-data;
worker_processes auto;
pid /run/;
include /etc/nginx/modules-enabled/*.conf;

events {
	worker_connections 768;

http {
	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	types_hash_max_size 2048;
	server_tokens off;
	include /etc/nginx/mime.types;
	default_type application/octet-stream;
	ssl_protocols TLSv1.2 TLSv1.3; 
	ssl_prefer_server_ciphers on;
	access_log /var/log/nginx/access.log;
	error_log /var/log/nginx/error.log debug;
	add_header Set-Cookie "HttpOnly; Secure";
	add_header X-Frame-Options "SAMEORIGIN";
	gzip off;
	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;
        listen 80;
	    return 301 https://$host$request_uri;
server {
	large_client_header_buffers 4 16k;
	listen 443 ssl;
    access_log /var/log/nginx/nginx.vhost.access.log;
    error_log /var/log/nginx/nginx.vhost.error.log;
	ssl_certificate /etc/ssl/certs/bundle.crt;
    ssl_certificate_key /etc/ssl/certs/www_mydomain_com.key;
    ssl_prefer_server_ciphers on;

	root /var/www/html;
	index index.html index.htm index.nginx-debian.html;

	location / {
		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
		proxy_redirect off;
		proxy_set_header   X-Forwarded-For $remote_addr;
		proxy_set_header   Host $http_host;

	location ~ ^/(room|socket\.io) {
		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
		proxy_set_header Host $http_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_pass_request_headers on;

	location /wsapp {
	    proxy_http_version 1.1;
	    proxy_set_header Upgrade $http_upgrade;
	    proxy_set_header Connection "upgrade";
	    proxy_set_header Host $host;
	    proxy_hide_header 'Access-Control-Allow-Origin';
const server = require('https').createServer(credentials, app).listen(8080, '');
const io = require('')(server,
	cors: { 
		origin: ["*"], 
		methods: ["GET", "POST"],
        	transports: ['websocket', 'polling'],
        	autoConnect: true,
        	pingInterval: 25000, 
        	pingTimeout: 180000, 
	allowEIO3: true,
	cookie: {
		name: "domainio",
		httpOnly: false,
		secure: true
var socket = io.connect('',
        'transports': ['polling'],
        'autoConnect': true,
        'pingInterval': 25000, // default - 25000
        'pingTimeout': 180000, // default - 60000  
        'reconnection': true,
        'reconnectionDelay': 1000,
        'reconnectionDelayMax': 5000,
        'reconnectionAttempts': 5,
		'secure': true

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @swapnilbaxi,

I’ll urge to you check your Nginx Error Logs, the error will most certainly be logged there. Once it’s logged there it will be a more specific one rather than just Generic 400 Error.

Once you have the specific error you can further troubleshoot what’s going on. Until tell it’s just some shots in the dark.

If you are unable to find a solution once you have the errors from the Nginx Error_log, you can post them here, we’ll try to help out!