fix(proxy/ReverseProxy): dont 404 non proxy URLs
Introduced by b78a94645
This commit is contained in:
@@ -34,6 +34,8 @@ export function localToBackendUrl(basePath, target, localPath) {
|
|||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const PREFIX = '/proxy/v1/'
|
||||||
|
|
||||||
export default class ReverseProxy {
|
export default class ReverseProxy {
|
||||||
constructor(app, { httpServer }) {
|
constructor(app, { httpServer }) {
|
||||||
app.config.watch('reverseProxies', proxies => {
|
app.config.watch('reverseProxies', proxies => {
|
||||||
@@ -44,7 +46,7 @@ export default class ReverseProxy {
|
|||||||
if (typeof config === 'string') {
|
if (typeof config === 'string') {
|
||||||
config = { target: config }
|
config = { target: config }
|
||||||
}
|
}
|
||||||
config.path = '/proxy/v1/' + removeSlash(path) + '/'
|
config.path = PREFIX + removeSlash(path) + '/'
|
||||||
|
|
||||||
return config
|
return config
|
||||||
})
|
})
|
||||||
@@ -59,6 +61,10 @@ export default class ReverseProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_proxy(req, res) {
|
_proxy(req, res) {
|
||||||
|
if (!req.url.startsWith(PREFIX)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const config = this._getConfigFromRequest(req)
|
const config = this._getConfigFromRequest(req)
|
||||||
|
|
||||||
if (config === undefined) {
|
if (config === undefined) {
|
||||||
|
|||||||
Reference in New Issue
Block a user