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
http GET request is not proxied #199
Comments
Did you manually verify if the server is responding at all on the GET request? |
Yeah, I did, the server was up and running. Sending GET request to |
Wondering if the other proxies are affecting the GET proxy... |
I had a try just now, but the |
Please verify proxy GET with a different target: I tried this setup without any issues: var express = require('express')
var proxy = require('http-proxy-middleware');
var httpbinProxy = proxy({
target: 'https://httpbin.org',
secure: false,
changeOrigin: true // for vhosted sites, changes host header to match to target's host
})
var app = express()
app.use('/get', httpbinProxy)
app.listen(3000)
// `http://localhost:3000/get` returning response as expected |
I've also modified my |
A wild shot: try adding There is little I can do. Guess you'll have to check your client, proxy and server setup more thoroughly. |
After a loooot of attempts, it suddenly works when I move my proxies settings in front of Like this, browserSync({
port: 5200,
ui: {
port: 5201 // port where browsersync admin site will be avaialble
},
//cors: true,
server: {
baseDir: 'src', // base folder to serve
middleware: [
historyApiFallback(),
// IT WORKS AT HERE !!!
authenticationProxy,
TACProxy,
infoProxy,
webpackDevMiddleware(bundler, {
publicPath: 'http://localhost:5200/',
noInfo: true
}),
webpackHotMiddleware(bundler)
// IT WAS AT HERE, BUT GET NOT WORKING
// proxy for backend
//authenticationProxy, //this works, POST method
//TACProxy, //this works, DELETE method
//infoProxy // GET method NOT working, but POST works! same target host as the one above
]
},
files: [
'src/*.html'
]
}); |
Glad to hear you've found a solution. Just wondering... Which of the two webpack middleware is conflicting with your GET proxy? |
|
Expected behavior
GET request should be proxied properly
Actual behavior
GET request is totally ignored by the http-proxy-middleware while POST and DELETE request to the same target server work as expected
Setup
proxy middleware configuration
server mounting
As the code snippet shown above, the
TACProxy
andinfoProxy
have same target host,remote456.com
. If I send POST request to them, both proxies works; but GET request is always ignored by the proxy.The response of GET request is suppose to be a json, but it's actually the html that should be rendered by the browser. It's like
The text was updated successfully, but these errors were encountered: