Why does CORS apply on localhost when using 'lvh.me'?
I was having an issue with CORS in my Rails App and my JS front-end app,
before I used rack-cors (https://github.com/cyu/rack-cors).
The JS front-end app will be a subdomain of my Rails app. So I should not
be having this issue in production. However on local, I am running my
front-end app on a server with:
python -m SimpleHTTPServer
I then access it via http://dashboard.lvh.me:8000. All calls are made to
the backend rails app to api.lvh.me:3000.
When doing requests without handling CORS, I get a CORS error. Why am I
getting a CORS error when both are on the same subdomain (lvh.me)? This
happened in all browsers.
Why do I need to use rack-cors? Will this also happen in production? Right
now, I am just running rails s. When using nginx, will this go away when
both are on the same domain, but different subdomains?
No comments:
Post a Comment