Skip to content

If i use nginx as proxy,this port is 80,react app's port 3000,webpackHotdev create websocket with port 80,and the error occur. #2591

@cyssxt

Description

@cyssxt

Description

If i use nginx as proxy,nginx's port is 80,react app's port is 3000,webpackHotdev create websocket with port 80,and the error occur.

What are you reporting?
Can't react-scripts support proxy?

Tell us what you think should happen.

webpack-dev-server\client\index.js

 create html websocket client

var socketUrl = url.format({
protocol: protocol,
auth: urlParts.auth,
hostname: hostname,
port: (urlParts.port === '0') ? window.location.port : urlParts.port,
pathname: urlParts.path == null || urlParts.path === '/' ? "/sockjs-node" : urlParts.path
});
this port real value is 3000

webpackHotDevClient.js

  nodejs create webscoket server!

var connection = new SockJS(url.format({
protocol: window.location.protocol,
hostname: window.location.hostname,
port: window.location.port,
// Hardcoded in WebpackDevServer
pathname: '/sockjs-node'
}));
this port real value is 80
So we can't communicate through websocket ,while we use a proxy server !
I think if we want to resolve this bug ,we should add a config to set websocket port and host!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions