fe-dev-server-plugin-proxy
v0.0.21
Published
Proxy plugin for fe-dev-server
Readme
fe-dev-server-plugin-proxy
A plugin for request proxy
Config
target
string / object - the proxy target for request, supporting multiple target with different url prefix, for examples:
// single target
({
target: 'http://localhost:8080'
})
// multiple target with different url
({
target: {
'/api': 'http://localhost:8080',
'/static': 'http://localhost:8081',
}
})
secure
true / false, Default: true - if you want to verify the SSL Certs
changeOrigin
true / false, Default: true - changes the origin of the host header to the target URL
requestInterceptor
function - modify the request sending to target, allow pathname / headers / method / search, for examples:
// using the return of requestInterceptor to modify request
({
requestInterceptor: ({ pathname, headers, method, search }) => ({
pathname,
headers: { ...headers, 'custom-header': 'value' },
method,
search,
})
})
responseInterceptor
function - modify the response sending to client, allow headers / statusCode, for examples:
({
responseInterceptor: ({ headers, statusCode }) => ({
headers: {
...headers,
'custom-header': 'value',
},
})
})
