ruby-on-railsapachethinfayeprivate-pub

Rails 3.2 PrivatePub in production faye.js not found


I'm having an issue with a gem called private_pub that uses a faye gem and thin server.

This all works fine in development, but on the server I can get everything started up fine but on the page where I'm using private_pub I get an error in the js console (chrome) that says

GET http://myapp.example.com/faye.js 406 (Not Acceptable) 

and when I view http://myapp.example.com/faye.js in the browser (url changed) I get an empty screen where in development it displays all the js code. Also I can see in chrome's developer tools I can see in development the type is "Pending" and in production I'm seeing it passed as "text/html"

I've googled and googled and have come up with exactly nothing. Can anyone point me in the right direction.

Is there some special mime-type that is being passed here that I need to configure apache or rails to accept?

Thank you in advance


Solution

  • HAZZAH!

    I figured it out.

    I jumped through all kinds of hoops and am not 100% sure that the solution I found isn't working because of some of the other things I tried but...

    First thing I tried was following a tutorial for installing Thin with a Rails app on Centos, (from Slicehost's docs) Slicehost Articles: CentOS - thin web server for Ruby and did a whole bunch of thin configurations. But I don't believe this was necessary because private_pub/faye is supposed to handle this all for you. (from what I understand)

    One important thing is that I know you need to use the startup that private_pub describes, even though you can start thin directly.

    RAILS_ENV=production bundle exec rackup private_pub.ru -s thin -D -E production
    

    The '-D' makes sure that it runs as a background process.

    In my private_pub.yml:

    production:
      server: "http://myapp.example.com:9292/faye" 
      secret_token: "{SECRET_TOKEN HERE}" 
      signature_expiration: 3600 # one hour
    

    I added in the port# here and it all works now.