Yopi pada 18 Agustus 2018

Halo teman teman, para master, suhu, salam kenal :)

Saya mau nanya, saya punya masalah waktu implementasi actioncable di VPS environment production, ketika pakai koneksi dari tethering HP berhasil connect, tapi ketika pakai indihome error 404, kira kira apa ya yang salah, berikut nginx.conf saya:

upstream puma {
  server unix:///home/[username]/[appname]/shared/tmp/sockets/puma.sock;
}

server {
    listen 80 default_server deferred;

    root /home/[username]/[appname]/current/public;

        location ^~ /assets/ {
            gzip_static on;
            expires max;
            add_header Cache-Control public;
        }

        try_files $uri/index.html $uri @puma;
        location @puma {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_pass http://puma;
        }

        location /cable {
            proxy_pass http://puma;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";

            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-Proto https;
            proxy_redirect off;
        }

        error_page 500 502 503 504 /500.html;
        client_max_body_size 10M;
        keepalive_timeout 10;

}

dan ini production.rb nya:

config.action_cable.url = 'ws://[IP_ADDRESS]/cable'
config.action_cable.allowed_request_origins = [ 'http://[IP_ADDRESS]' ]

mungkin dari teman-teman ada yang pernah mengalami masalah yang sama dan berhasil menanganinya, boleh dong sharing caranya, terima kasih ya :)