var proxyMiddleware = require('http-proxy-middleware')
var proxyTable = {
'/web':{
target: 'http://10086.com:8080', // running on localhost set 'http://localhost:8080'
changeOrigin: true,
pathRewrite: {
'^/web' : '/', // true request to remote server will remove suffix '/web'
},
cookieDomainRewrite:{
'*':'localhost' // all domain cooke rewrite to localhost
}
}
}
Object.keys(proxyTable).forEach(function (context) {
var options = proxyTable[context]
if (typeof options === 'string') {
options = { target: options }
}
app.use(proxyMiddleware(context, options))
})
I can not get any cookie from remote server,'cookieDomainRewrite' useless that can not search in module source code
http-proxy-middleware uses http-proxy. that's probably why you can't find references in this project.
cookieDomainRewrite is added in http-proxy v1.16.1 (https://github.com/nodejitsu/node-http-proxy/commit/8cb451f20cff0a19fc9576fc2558307fb17a5710)
Check if you are using the right version with npm ls in your project.
@chimurai Thx
@chimurai
My http-proxy 's version is v1.16.2, but cookieDomainRewrite also don't work, please help me to resolve this problem. Thanks
Most helpful comment
@chimurai
My
http-proxy's version isv1.16.2, butcookieDomainRewritealso don't work, please help me to resolve this problem. Thanks