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.

configurable hostname for sockjs-node

See original GitHub issue

https://github.com/facebookincubator/create-react-app/blob/master/packages/react-dev-utils/webpackHotDevClient.js#L61-L69 as shown in this file there is no way to config hostname and everything about this sockjs-node ajax request. is there any reason for it that there is no configuration for it ?

I`m working on a product which is not spa. uses cookie sessions and there is no authentication token obviously. so I was in need of hot reload to. I load my react app inside the main app and for the hot reload I did change the source code of webpackHotDevClient to what I want in order to make /sockjs-node/info ajax works. without changing this config /sockjs-node/info hits http://app.dev/sockjs-node/info but I want it to hit on http://localhost:3000/sockjs-node/info.

var connection = new SockJS(
  url.format({
    protocol: "http",
    hostname: "localhost",
    port: "3000",
    // Hardcoded in WebpackDevServer
    pathname: '/sockjs-node',
  })
);

after this change things are working fines with hot reload on

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:14
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
luckydrqcommented, Sep 29, 2017

react-dev-utils may be an internal package for create-react-app but i highly recommend to make it configurable. I believe that many people would use this project for reference and make their own configs, just like me 😃

1reaction
dburrowscommented, Dec 11, 2017

I fixed this problem in this PR #1994 but it never got merged, there was a lot of discussion about a better solution but I was never entirely sure what the better solution was. Would love to get this fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

django - Webpack - turning off requests to /sockjs-node/info or ...
I am thinking what's going on is all the devServer configuration stuff only affects the server side of things. I.e. where does Node...
Read more >
Advanced Configuration - Create React App
Variable Development Production BROWSER ✓ Used 🚫 Ignored BROWSER_ARGS ✓ Used 🚫 Ignored HOST ✓ Used 🚫 Ignored
Read more >
WebSockets With Spring, Part 2 - Medium
SockJS is one of the existing WebSocket browser fallbacks. SockJS includes a protocol, a JavaScript browser client, and Node.js, Erlang, Ruby ...
Read more >
webpack-dev-server.md
A webpacker proxy site that pulls in the.
Read more >
http-proxy-middleware - npm
Node.js proxying made simple. Configure proxy middleware with ease for connect, express, browser-sync and many more.
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