Skip to content

Instantly share code, notes, and snippets.

@robzolkos
Last active October 15, 2020 14:55
Show Gist options
  • Save robzolkos/e776f90b85fa0a131d6f4af41aeb4c2d to your computer and use it in GitHub Desktop.
Save robzolkos/e776f90b85fa0a131d6f4af41aeb4c2d to your computer and use it in GitHub Desktop.
nginx action cable error
curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: portal.example.com.au" -H "Origin: https://portal.example.com.au" https://portal.example.com.au/cable
HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.3 (Ubuntu)
Date: Thu, 15 Oct 2020 14:33:10 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Location: https://portal.example.com.au/cable
upstream puma_portal {
server unix:///home/example/apps/portal/shared/tmp/sockets/portal-puma.sock;
}
server {
server_name portal.example.com.au;
root /home/example/apps/portal/current/public;
try_files $uri/index.html $uri.html $uri @puma_portal;
location @puma_portal {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_read_timeout 300;
proxy_pass http://puma_portal;
}
location /cable {
proxy_pass http://puma_portal/portal;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location ~ ^/assets/ {
gzip_static on;
expires max;
root /home/example/apps/portal/current/public;
add_header Cache-Control public;
add_header Last-Modified "";
add_header ETag "";
break;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/portal.example.com.au/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/portal.example.com.au/privkey.pem; # managed by Certbot
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment