ActionCable with rails 5.1.3 not able to upgrade websocket

315 Views Asked by At

The real time notification with ActionCable works fine in my development environment which uses puma server.

However it is not working while I deploy it in production. I am getting these errors.

I, [2017-08-29T12:19:15.074453 #4737]  INFO -- : [9850bab1-05b1-4844-b6f2-857061c20800] Started GET "/cable" for 202.166.198.221 at 2017-08-29 12:19:15 +0000
I, [2017-08-29T12:19:15.076219 #4737]  INFO -- : [9850bab1-05b1-4844-b6f2-857061c20800] Started GET "/cable/"[non-WebSocket] for 202.166.198.221 at 2017-08-29 12:19:15 +0000
E, [2017-08-29T12:19:15.076462 #4737] ERROR -- : [9850bab1-05b1-4844-b6f2-857061c20800] Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: close, HTTP_UPGRADE: )
I, [2017-08-29T12:19:15.076658 #4737]  INFO -- : [9850bab1-05b1-4844-b6f2-857061c20800] Finished "/cable/"[non-WebSocket] for 202.166.198.221 at 2017-08-29 12:19:15 +0000
I, [2017-08-29T12:19:18.613916 #4737]  INFO -- : [15f6fde7-2329-4e77-b97b-b7b409f9ae9a] Started GET "/cable" for 202.166.198.221 at 2017-08-29 12:19:18 +0000
I, [2017-08-29T12:19:18.615298 #4737]  INFO -- : [15f6fde7-2329-4e77-b97b-b7b409f9ae9a] Started GET "/cable/"[non-WebSocket] for 202.166.198.221 at 2017-08-29 12:19:18 +0000

I never got "Failed to upgrade to WebSocket" in my development server. Googled a lot but none of the solutions worked.

cable.yml prod setting

production:
  adapter: redis
  url: redis://localhost:6379/1

Do I have to change anything in nginx.conf coz lots of other posts are suggesting to do make some change. I did it, but didn't work.

0

There are 0 best solutions below