Subdomains not working in 1.0.0
See original GitHub issueDescription
Since 1.0.0 we cannot visit subdomains on the dev server anymore. This is usfeful for devs who use subdomains to serve different data based on subdomains with CRA.
Expected behavior
Visiting the app on http://test.localhost:3000/ should display the app the same as the usual: http://localhost:3000/
Actual behavior
Instead of the app we get: Invalid Host header
Reproducible Demo
create a new react app and visit any subdomain.
Extra
- Would it be possible to add an option to the package json to use
disableHostCheck: true
in the webpackDevServer.config ? - is it possible to add an option to open the browser on a subdomain?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:22 (12 by maintainers)
Top Results From Across the Web
server ip address could not be found - Godaddy - YouTube
0:42 Demonstration of subdomain not working issue ; 1:17 Login into godaddy account ; 1:35 Manage DNS of your domain ; 2:00 Types...
Read more >This site can't be reached - Subdomain not working - YouTube
I have applied ssl for my domain afterwards i got the following error for sub-domain.This site can't be reached.Server IP could not be ......
Read more >Problem while creating subdomain | cPanel Forums
Subdomain in that account was set to unlimited, and i have try to upgrade cpanel to Latest Stable Version, but the problem still...
Read more >iOS universal links (applinks) not working for subdomains
Feels like when i'm adding more than the domain itself in the entitlements it stops working completely. "applinks:*.domain.com" is fine but ...
Read more >Problems with SOME subdomains regarding SSL Certificate
Hullo! I have a LetEncrypt Certificate enabled using the excellent tool provided within VirtualMin: Server Configuration / Manage SSL ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Let’s reopen the issue for subdomain use case specifically, as we should indeed support any subdomains of
localhost
by default. I believe we’re waiting for a WDS pull request to land for this.But in the meantime you can add
DANGEROUSLY_DISABLE_HOST_CHECK=true
to your env file if this is blocking you.Even though the
allowedHosts
feature landed in WDS, there is no way to use that feature from an unejected create-react-app, as far as I know.This means if you want to use the proxy feature (to forward requests to a backend API, for example), WDS will check the host, and subdomains (e.g.
subdomain.localhost
) will not be allowed. This could be allowed with a WDS config by settingallowedHosts
to".localhost"
, for example, but there isn’t a way to pass in this config via create-react-app.