ruby on rails - nginx reverse proxy setup resulting in strange access-control-allow-origin issue -


i have rails application setup on nginx/passenger on ubuntu. added faye running on thin requires adding reverse proxy server setup in nginx config. managed work setup strange: works if access server www.mydomain.com , access reverse proxy using javascript code @ mydomain.com/faye. although manage access faye server way, chrome browser console repeatedly flashes access-control-allow-origin error, know not long-term solution. error makes sense me couldn't fix after many tries.

xmlhttprequest cannot load mydomain.com/faye. origin www.mydomain.com not allowed access-control-allow-origin. 

the obvious solution access www.mydomain.com , www.mydomain.com/faye, doing results in 502 gateway error. if strip both www's 502 error.

i tried rewrite www.mydomain.com mydomain.com in nginx , access mydomain.com, still doesn't work.

below abridged nginx.conf. assistance appreciated!

http {   passenger_root <path_to_passenger_root>   passenger_ruby <path_to_passenger_ruby>    <abridged...>    upstream faye_server {     server 0.0.0.0:9292;   }    server {     listen 80;     server_name mydomain.com www.mydomain.com;     root <path_to_root>     passenger_enabled on;      <abridged...>      location /faye {       proxy_pass http://faye_server;     }   }    <similar section listening on port 443> } 

hi did know can run faye directly on passenger now? no need have thin in between.

check out: https://github.com/faye/faye-websocket-ruby#running-the-app-with-passenger


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -