简体   繁体   中英

ActionCable doesn't work with Unicorn in Rails production server (nginx)

I have a RoR project.

However, when I use Nginx and Unicorn to run my actioncable in production server it doesn't work like it does in my development Rails environment.

The error I got is as shown in below:

Rack::Lint::LintError: Status must be >=100 seen as integer

I can't understand the cause of error.

Try adding ENV['RACK_ENV'] = "deployment" to your unicorn config file. See this issue for more details: https://github.com/rails/rails/issues/26179

I've been through the same error and the below solution worked for me. You can upgrade your nginx.confi file with below configurations:

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

I hope this solution helps :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM