3.8.1 • Published 3 years ago
@huangapple/midway-http-proxy v3.8.1
HTTP 代理组件
HTTP 代理组件
适用于 @midwayjs/faas 、@midwayjs/web 、@midwayjs/koa 和 @midwayjs/express 多种框架的 HTTP 代理组件,支持GET、POST等多种请求方法。
Usage
- 安装依赖
$ npm i @midwayjs/http-proxy --save- 在 configuration 中引入组件,
import * as proxy from '@midwayjs/http-proxy';
@Configuration({
imports: [
// ...other components
proxy
],
})
export class AutoConfiguration {}配置
export const httpProxy = {
host: 'http://127.0.0.1',
match: /\/assets\/(.*)/,
target: 'http://127.0.0.1/$1',
//额外的axios请求config, 会照搬过去
extReqOptions:{
//用来设置不校验https的ssl
httpsAgent: new https.Agent({ rejectUnauthorized: false })
}
}3.8.1
3 years ago