I am working on an app, where server and the api-consuming client reside under different domains, so I would like to use CORS. To do so, I have to set corresponding http hea
We generally disliked CORS headers. We prefer using HAProxy to to redirects.
With HAProxy you can set up all requests coming to website.com/api/ to be internally redirected to your rails machine.
frontend main *:80
acl api path_beg -i /api
acl app path_beg -i /app
backend app_backend
reqrep ^([^\ ]*)\ /app/(.*) \1\ /\2
balance roundrobin
server app_files smartphoneapp.localhost:8000
backend api_backend
reqrep ^([^\ ]*)\ /api/(.*) \1\ /\2
balance roundrobin
server app_api localhost:3000