What do you want to do
I want to set up a chat app that doesn't work in the production environment
I want to identify the elements I need to improve
Run Environment
Rails 5.2.4.2
nginx1.12.2
unicorn 5.4.1
AmazonLinux2
error
Developer Tool Console
WebSocket connection to 'wss:// Domain/cable' failed: Error during WebSocket handshake: Unexpected response code: 404
log/production.log
Failed to upgrade to WebSocket (REQUEST_METHOD:GET, HTTP_CONNECTION:close, HTTP_UPGRADE:)
What I've tried now
1. Enable config.action_cable.allowed_request_origin=['http://example.com', /http:\/\/example.*/]
and set the domain
What would you like to know
What else do you need?
After searching for all the elements that might be necessary, I noticed the following three points, but it was difficult to choose because some of them were used and others were not.
·ELB setting for AWS (does not support WebSockets communication over HTTP/HTTPS?)
·Set cable in /etc/nginx/conf.d/*.conf
·Redis settings
I would appreciate it if you could let me know.Thank you for your cooperation.
javascript ruby-on-rails ruby nginx
https://teratail.com/questions/231471
Based on the above content, I was able to solve myself.
"·Other than ""Enable domain in config/environments/production.rb file""
"Added the following code to nginx***.conf
location/cable{
proxy_pass http:// Application Server /cable;
proxy_http_version 1.1;
proxy_set_header Upgrade websocket;
proxy_set_header Connection Upgrade;
proxy_set_header X-Real-IP$remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
581 PHP ssh2_scp_send fails to send files as intended
612 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.