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

[devex] CORS errors in socket io stuff #156

Closed
benjaminpjones opened this issue Jan 2, 2024 · 6 comments · Fixed by #184
Closed

[devex] CORS errors in socket io stuff #156

benjaminpjones opened this issue Jan 2, 2024 · 6 comments · Fixed by #184

Comments

@benjaminpjones
Copy link
Collaborator

Vite changed the default port from 3000 to 5173 (vitejs/vite#8148). I believe this is the source of the CORS errors we see in yarn start, since our origin is still set to http://localhost:3000 (source code)

We can either update the origin or pass --port 3000 to vite.

@merowin
Copy link
Collaborator

merowin commented Jan 30, 2024

I've tried around a bit, and the following has worked for me:

const LOCAL_ORIGIN = "http://127.0.0.1:5173";

curiously this did not work for me:

const LOCAL_ORIGIN = "http://localhost:5173";

Is the first a sensible solution, or should I try to make it work with the second?

@benjaminpjones
Copy link
Collaborator Author

first is a sensible solution, but it does make me wonder... the second solution doesn't work if you change what you enter in the Browser's URL bar?

@benjaminpjones
Copy link
Collaborator Author

I'm also seeing potential ipv6 issues: https://stackoverflow.com/a/25657673/5001502

idk, might pan out, but I don't think it's worth the trouble since you already have a solution.

@merowin
Copy link
Collaborator

merowin commented Jan 30, 2024

first is a sensible solution, but it does make me wonder... the second solution doesn't work if you change what you enter in the Browser's URL bar?

Yeah good point, if I change the url to http://localhost:5173/ then the second solution works.

@merowin
Copy link
Collaborator

merowin commented Feb 7, 2024

I think we could close this then, because I've committed and merged the second solution a while ago.

However, when I start the vue-client, the console gives the link http://127.0.0.1:5173 , which I often use to open in browser. So the first solution would be a little bit easier for me to work with (I don't know if its the same for you).

Is there a downside to switching to the first solution?

@benjaminpjones
Copy link
Collaborator Author

Either is works for me since localhost resolves to 127.0.0.1 on my computer, but yeah it sounds like a good idea to pick the one that shows up in the terminal

@merowin merowin linked a pull request Feb 7, 2024 that will close this issue
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.

2 participants