worker_processes 1; events { worker_connections 1024; } http { upstream client { server frontend:3000; } server { listen 80; error_log /var/log/nginx/error.log; access_log /var/log/nginx/access.log; client_max_body_size 10M; location / { proxy_pass http://client; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Ssl on; # Optional proxy_set_header X-Forwarded-Port $server_port; proxy_set_header X-Forwarded-Host $host; # proxy_set_header X-Forwarded-Host $server_name; } location /api { proxy_set_header X-Real_IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; proxy_set_header Host $http_host; proxy_set_header Upgrade $http_upgrade; proxy_pass_header Set-Cookie; rewrite ^/api(.*)$ $1 break; proxy_pass http://server:8000; } # location /cable { # proxy_pass http://server:8000; # proxy_http_version 1.1; # proxy_set_header Upgrade $http_upgrade; # proxy_set_header Connection "upgrade"; # proxy_pass_header Set-Cookie; # # rewrite ^/cable(.*)$ $1 break; # } # location /socksjs-node { # proxy_pass http://server:8000; # proxy_http_version 1.1; # proxy_set_header Upgrade $http_upgrade; # proxy_set_header Connection "upgrade"; # # rewrite ^/cable(.*)$ $1 break; # } } }