-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
Offer support for root path proxy? #3572
Labels
Comments
Please propose changes to the proxy behavior in #3366. |
Yes.
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Federico Zivolo <[email protected]>
Sent: Friday, December 8, 2017 10:17:23 PM
To: facebookincubator/create-react-app
Cc: Subscribed
Subject: [facebookincubator/create-react-app] Offer support for root path proxy? (#3572)
Right now we can define some proxied paths using the package.proxy property, but there's not (AFAIK) a way to tell the app to do something like this:
/ # redirect to localhost:3001
/CRA # serve localhost:300 (CRA)
In my own project I managed to get this to work with react-app-rewired and the following changes:
HtmlWebpackPlugin({
inject: truem
template: './public/index.html',
filename: 'app.html',
});
and changing the historyApiFallback to { index: '/app.html' }.
The first change is needed because otherwise the proxy will be bypassed if your html file is called index.html (because webpack-dev-server fallbacks to it automatically ignoring the proxy rules).
The second change is needed to tell webpack-dev-server to serve app.html instead of index.html.
Once you have these changes, you are able to write proxy rules like this:
{
// ...
"proxy": {
"/": {
"target": "<url>",
// ...
},
"/CRA": {
"target": "http://localhost:300" // or maybe have a way to tell `bypass` to return `false`?
// ...
},
// ...
}
Is this something you'd like to support?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#3572>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ALEaK4nugau64eMEN-uBVaWPT4YQ8Smsks5s-kITgaJpZM4Q7_-D>.
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Right now we can define some proxied paths using the
package.proxy
property, but there's not (AFAIK) a way to tell the app to do something like this:In my own project I managed to get this to work with
react-app-rewired
and the following changes:and changing the
historyApiFallback
to{ index: '/app.html' }
.The first change is needed because otherwise the proxy will be bypassed if your html file is called
index.html
(becausewebpack-dev-server
fallbacks to it automatically ignoring the proxy rules).The second change is needed to tell
webpack-dev-server
to serveapp.html
instead ofindex.html
.Once you have these changes, you are able to write proxy rules like this:
Is this something you'd like to support?
The text was updated successfully, but these errors were encountered: