Skip to content

Improve localhost checking in checkHost #903

Closed
@mocheng

Description

@mocheng

What is the current behavior?
In 0.16.4, webpack-dev-server introduced host checking #887 . Even though localhost and 127.0.0.1 is by default exempt from host checking, it still brings trouble to local development.

In our team, our local environment host is localhost.xxxx.com to share cookie with domain xxxx.com. But, localhost.xxxx.com is not taken as localhost.

What is the expected behavior?
It would be better to have localhost checking with regex.

Just change

if(hostname === "127.0.0.1" || hostname === "localhost") return true;
to be like

	// always allow localhost host, for convience
	if(hostname === "127.0.0.1" || hostname.test(/localhost/)) return true;

I know there is a disableHostCheck option to web-dev-server. However, we're not directly depending on webpack-dev-server, but on react-server which controls options to webpack-dev-server. So, an improved localhost checking is preferred.
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions