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

127.0.0.1 instead of localhost not an allowed redirect url #9603

Closed
7 tasks done
onionhammer opened this issue Aug 9, 2022 · 3 comments
Closed
7 tasks done

127.0.0.1 instead of localhost not an allowed redirect url #9603

onionhammer opened this issue Aug 9, 2022 · 3 comments

Comments

@onionhammer
Copy link

onionhammer commented Aug 9, 2022

Describe the bug

I'm trying to configure my OIDC provider to redirect back to vite running locally, and while localhost works fine, 127.0.0.1 is now advertised in the console as the link to click on.

Why was this changed? According to the history the title of the #8543 it looks like it should show the opposite. It should at least be configurable..

image

Reproduction

Create a new vite app, run npm run dev, in console it shows "local: http://127.0.0.1..."

System Info

Windows x64

Used Package Manager

npm

Logs

No response

Validations

@onionhammer
Copy link
Author

Workaround: Run vite with --host argument

@sodatea
Copy link
Member

sodatea commented Aug 10, 2022

It's explained in the docs.

https://vitejs.dev/config/server-options.html#server-host

The first case is when localhost is used. Node.js under v17 reorders the result of DNS-resolved address by default. When accessing localhost, browsers use DNS to resolve the address and that address might differ from the address which Vite is listening. Vite prints the resolved address when it differs.
You can set dns.setDefaultResultOrder('verbatim') to disable the reordering behavior. Vite will then print the address as localhost.

@sodatea sodatea closed this as completed Aug 10, 2022
@sodatea
Copy link
Member

sodatea commented Aug 10, 2022

I suggest upgrading your Node.js version or manually setting dns.setDefaultResultOrder('verbatim') in the Vite config.
Otherwise, the possibility remains that another server can also listen on localhost:5050 and hijack the connections from Vite.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants