3

I'm building an app on my localhost. When I login via one subdomain, (e.g. sub.localhost/) I need to access that logged-in user with Auth:: in all other subdomains of my application (e.g. sub2.localhost/, sub3.localhost/).

I made the change as this post suggests in config/session.php:

'domain' => '.localhost/',

No beans. In fact now I can't log in at all. Does this only work with a non-localhost domain? That would suck.

Community
  • 1
  • 1
sterfry68
  • 1,063
  • 2
  • 14
  • 30

1 Answers1

2

Did you try with only .localhost instead of .localhost/

if it is still doesn't work you can create an other host pointing to 127.0.0.1 : edit the /etc/hosts or Windows\System32\drivers\etc\hosts to set an other hostname for example : 127.0.0.1 host.loc

user3739239
  • 146
  • 3
  • Yes. Tried `.localhost` as well. Same result. I'll try `127.0.0.1`. – sterfry68 Jun 13 '14 at 22:08
  • I just now understood the 2nd part of your answer. That worked! Here's what I did: edit hosts file in Windows\System32\drivers\etc\ to redirect to a fake url `127.0.0.1 fakeurl.com`. Then of course I also added that following code to httpd-vhosts.conf file: `DocumentRoot "/path/to/my/laravel/app"ServerName sub1.fakeurl.com`. I did this for each of my subdomains. Finally I restarted my server and it works great! I'm going to edit your answer to include everything to change... it's hard to read here. – sterfry68 Jun 14 '14 at 16:45