Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't Work on Localhost #16

Closed
Nicholas-Westby opened this issue Jun 16, 2017 · 5 comments · May be fixed by #27
Closed

Doesn't Work on Localhost #16

Nicholas-Westby opened this issue Jun 16, 2017 · 5 comments · May be fixed by #27

Comments

@Nicholas-Westby
Copy link

I spent a few hours trying to figure out why this library didn't seem to be working, and why it wasn't creating the "sbjs" cookies. I figured out that it doesn't seem to like the localhost domain used by Visual Studio (e.g., "http://localhost:1234/"). Probably related to the way cookies work: https://stackoverflow.com/questions/1134290/cookies-on-localhost-with-explicit-domain

I have two options to recommend:

  • Modify the code that interacts with cookies so that it detects localhost and doesn't attempt to set the domain (I think cookies will work then).
  • Update the README.md to make a note that this won't work on localhost.

FYI, I'm using Chrome.

@afrozek
Copy link

afrozek commented Apr 18, 2018

TLDR;
Edit etc/hosts file
Use faketwitter.com:8080 > href link to > mydevapp.com:3000

I ran into a similar issue, the workaround for me was to modify your /etcs/hosts file and add any domain name for your localhost app.

ie. /etc/hosts
add the following lines
127.0.0.1 mydevapp.com
127.0.0.1 faketwitter.com

say your app is running on port 3000
I made another test web server(nodejs) on port 8080, and served a webpage which had a link to my app running on port 3000.

But instead of using localhost, use faketwitter.com:8080 > href link to > mydevapp.com:3000

I've tested this and it works like a charm.

image

@alex35mil
Copy link
Owner

^ This. And I wouldn't call it workaround. Using valid domain name for development is a must for real-world apps imo.

@Nicholas-Westby
Copy link
Author

Using valid domain name for development is a must for real-world apps imo.

I have built dozens of websites on localhost that disagree with you.

@AndreiSoroka
Copy link

AndreiSoroka commented Dec 4, 2018

@Nicholas-Westby I agree with you)
@alexfedoseev I think
#19 and #27
fix all problems with local development

@AndreiSoroka
Copy link

mr is opened 4 years...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants