Http-proxy-middleware Does Not Forward The Full Path
I am trying to configure BrowserSync to work in server mode and to proxy my API requests to the backend that runs on the same machine on a different port, using http-proxy-middlewa
Solution 1:
The prependPath
option is true
by default. This option is provided by the underlying lib: http-proxy.
prependPath: true/false, Default: true - specify whether you want to prepend the target's path to the proxy path
There are two ways to fix the issue:
1.) Change your target
from 'http://localhost:8080/api'
to 'http://localhost:8080'
var proxyApi = proxy('/api', {target: 'http://localhost:8080', logLevel: 'debug'});
2.) Alternatively you can set the option prependPath
to false
.
var proxyApi = proxy('/api', {target: 'http://localhost:8080/api', prependPath: false, logLevel: 'debug'});
Post a Comment for "Http-proxy-middleware Does Not Forward The Full Path"