question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Subdomains not working in 1.0.0

See original GitHub issue

Description

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:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:22 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
gaearoncommented, May 21, 2017

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.

2reactions
nawcommented, Jan 12, 2018

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 setting allowedHosts to ".localhost", for example, but there isn’t a way to pass in this config via create-react-app.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found