user3379926
user3379926

Reputation: 3945

How to handle cookies across domains in development

I developed two rails apps, they will each go on site.com and something.site.com respectively. In development mode they are run on localhost:3000 and localhost:4000, you must be logged into site.com to access something.site.com.

I have the cookies set up to handle domains from :all, and the tests all pass in relation to creating and destroying sessions. How ever I am unfamiliar how to test the cookies with out actually deploying the apps to production. I don't have staging servers, their small basic apps and I don't want them public. Is their any ways, on my mac, I can test (by launching both apps) the domain specific cookies?

Upvotes: 0

Views: 929

Answers (3)

bobbdelsol
bobbdelsol

Reputation: 1006

Look at using POW and Powder. Runs slower, but allows you to run concurrent apps on localhost.

Pow User's Manual

Upvotes: 0

Mario Olivio Flores
Mario Olivio Flores

Reputation: 2795

I bet you could update your hosts file to point something.localhost to 127.0.0.1

127.0.0.1 something.localhost in `/etc/hosts

I'm sure you've read that as long as the TLD is the same, this should work.

Upvotes: 0

hjing
hjing

Reputation: 4982

You can edit your hosts file located at /etc/hosts to point 127.0.0.1 to local.site.com and then access your rails apps at local.site.com:3000 and local.site.com:4000

127.0.0.1 localhost local.site.com

Upvotes: 1

Related Questions