proxy path fix
This commit is contained in:
@ -1,5 +1,7 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const http = require('http')
|
||||||
|
const url = require('url')
|
||||||
const Koa = require('koa')
|
const Koa = require('koa')
|
||||||
const serve = require('koa-static')
|
const serve = require('koa-static')
|
||||||
const convert = require('koa-convert')
|
const convert = require('koa-convert')
|
||||||
@ -14,7 +16,6 @@ const _ = require('koa-route')
|
|||||||
const mount = require('koa-mount')
|
const mount = require('koa-mount')
|
||||||
const httpProxy = require('http-proxy')
|
const httpProxy = require('http-proxy')
|
||||||
const pathToRegexp = require('path-to-regexp')
|
const pathToRegexp = require('path-to-regexp')
|
||||||
const http = require('http')
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @module local-web-server
|
* @module local-web-server
|
||||||
@ -61,7 +62,7 @@ function getApp (options) {
|
|||||||
.replace(re.index, arguments[index] || '')
|
.replace(re.index, arguments[index] || '')
|
||||||
})
|
})
|
||||||
proxy.once('proxyReq', function (proxyReq) {
|
proxy.once('proxyReq', function (proxyReq) {
|
||||||
proxyReq.path = route.new;
|
proxyReq.path = url.parse(route.new).path;
|
||||||
})
|
})
|
||||||
proxy.web(this.req, this.res, { target: route.new })
|
proxy.web(this.req, this.res, { target: route.new })
|
||||||
}))
|
}))
|
||||||
|
Reference in New Issue
Block a user