Share browser cookies across different servers and port numbers

We end up running our(single) app on multiple mongrels (a rails web server) in development.So naturally there is a need for sharing the cookies across these servers as if it is a single server(like in the production mode).

Except some versions of Internet Explorer all browsers by default treat different ports ( running on the same localhost machine) as different domains and block cooking from
being transferred one to other. Also noticed cookies set for localhost:3001  are not transferred to 127.0.0.1:3001.

This problem is also known as same origin policy.

There are multiple ways to get around this problem. The first one is to run an apache server and route the requests to either servers.

The other simpler solution is to disable security( i.e., same origin policy) in the browsers.

I prefer the second one as it is easy (at least to me).

On Firefox.

Try ( I could not get this one work though. YMMV)

https://addons.mozilla.org/en-US/firefox/addon/forcecors/

 

 

 

On Chrome

/opt/google/chrome/google-chrome –disable-web-security

References

http://stackoverflow.com/questions/3102819/chrome-disable-same-origin-policy

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s