Closed timargra closed 7 years ago
@timargra you should use changeOrigin
option
'/google': {
'target': 'http://www.google.com',
'changeOrigin': true
},
'/api/mite/': {
'target': 'https://yxz.mite.yo.lk/',
'changeOrigin': true
}
The proxy will send Host header which refers to localhost
if you don't turn on changeOrigin option.
Thanks!
Expected behaviour
Proxy should process requests the same way other servers (e.g. nginx) do.
Actual behaviour
Getting strange errors - sometimes 404, sometimes other unexpected responses - when proxing my APIs (e.g. Mite API) through Karma. When simply proxying http://www.google.com, I get a 404.
To diagnose the problem I proxied an nginx on localhost, but the access log seems fine
Environment Details
karma.config.js
nginx access.log (first line: direct request, second line: request proxied through Karma)
Steps to reproduce the behaviour