Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep the default development Host (localhost) unopinionated or configurable via razzle.config.js #713

Closed
madiodio opened this issue Jul 28, 2018 · 8 comments
Labels

Comments

@madiodio
Copy link

Hi, first of all would like to say that razzle is a great tool.
The readme says about the publicPath option in development that it is

explicitly set to localhost:3001 (and not / like many other setups do).

However, by doing this the development server url becomes not so much configurable and we end up encountering issues like these #263, #710, #610. I'm aware that you can change the default host by adding HOST= 192.168.1.2 to the .env file or by prepending HOST=192.168.1.2 to the razzle start as described here as a solution. But what if the IP changes everytime? What if you use a service like ngrok which generates a url some unique ids every time you start the server? Then you have to change the HOST almost everytime or it would just break.
Imo, this should be either unopinionated and just stay /or make it configurable.

@jaredpalmer
Copy link
Owner

Yeah this would be good to figure out. However, it needs an explicit host because Razzle needs 2 ports during development mode. Using just a slash would point to the wrong place.

@madiodio
Copy link
Author

Got it, can't disagree this would be hard to get right because of the 2 ports. Can you elaborate a bit why there is a need to set up 2 ports? Would it break everything (eg. needs a rewrite) if there was just 1 port?

@jaredpalmer
Copy link
Owner

Razzle would need to be runtime dependency or middleware, right now it’s build time. One port is for your server another port is for the webpack client bundle.

@gregmartyn
Copy link
Contributor

gregmartyn commented Aug 27, 2018

This was my attempt at a fix: #740

FWIW, I've been using that patch for a couple months now and haven't had any trouble.

@stale
Copy link

stale bot commented Nov 1, 2018

Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal.

@stale stale bot added the stale label Nov 1, 2018
@stale
Copy link

stale bot commented Nov 8, 2018

ProBot automatically closed this due to inactivity. Holler if this is a mistake, and we'll re-open it.

@stale stale bot closed this as completed Nov 8, 2018
@jmpowen
Copy link

jmpowen commented Jun 3, 2019

Just wondering if host has ever been made configurable? I ask because I am trying to create a docker container to run my razzle app. This requires me using the docker-machine ip 192.168.99.100

@gregmartyn
Copy link
Contributor

Mostly. There are still some issues.

#740 CLIENT_PUBLIC_PATH was merged, and Razzle v2 introduced Runtime environment variables, which both helped a lot.

There's a new issue in v3 with the socket that the client is trying to connect to. It's using localhost instead of CLIENT_PUBLIC_PATH.

#581 was never accepted (v3 version #1020) which I think would go a long way toward making these issues go away. It introduces a client port var instead of calculating which port the client should connect to in different places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants