[HowTo] Serve contents through a proxy
See original GitHub issueHello,
I am using haproxy
with a lot of different rules in production
and in development
in order to serve static files and to hand over requests.
In my current setup, I first launch my WebpackDevServer
on the port 9091, and then I launch my haproxy
container which bind localhost:9091
to some custom URL like dev.lan
on the port 80.
With react-app-cli
, the project opens automatically a new tab with the WebpackDevServer
URL.
Is it possible to add something in this project like CUSTOM_URL
which would allow me to set a custom HOST
and to omit the PORT
part?
Something like:
if (process.env.CUSTOM_HOST_AND_PORT) {
openBrowser(protocol + '://' + process.env.CUSTOM_HOST_AND_PORT + '/');
}
else {
openBrowser(protocol + '://' + host + ':' + port + '/');
}
This is a bit specific because I want to be able to dissociate the WebpackDevServer
from the openBrowser
URL opened?
Would you agree to integrate a pull request like that? Do you see another solution with the existing solution which does not involve to stop using my haproxy
container?
This is a minor issue as I certainly can just open a new tab with the right URL (dev.lan
) and everything is fine. But it looks a bit clumsy to have first to close the automatically opened tab.
Cheers,
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (6 by maintainers)
Ok! Thank you for your quick feedback and this tool again! I will be waiting for the release of the 0.9 then.
Oh, okay. To be honest this sounds a bit too esoteric for us to support this out of the box. With the support for custom
BROWSER
script (coming in 0.9.0) you can just point it to your own script that opens any URL you need.