Skip to content

Commit

Permalink
fix http proxy path error
Browse files Browse the repository at this point in the history
  • Loading branch information
miaowing committed Jul 24, 2019
1 parent 06f1265 commit cf4e64b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/proxy/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class Proxy implements IProxy {
}
const timeout = req.headers[HEADER_TIMEOUT] || 1000 * 30;
const proxyTimeout = req.headers[HEADER_TIMEOUT] || 1000 * 30;
const target = route.uri;
const target = route.uri + req.url;
this.proxy.web(req, res, {
target,
timeout: Number(timeout),
Expand Down Expand Up @@ -145,9 +145,7 @@ export class Proxy implements IProxy {
}
}
}
const target = `${this.proxyOptions.secure ? 'https' : 'http'}://${server.address}:${server.port}${
req.url
}`;
const target = `${this.proxyOptions.secure ? 'https' : 'http'}://${server.address}:${server.port}${req.url}`;
const timeout = req.headers[HEADER_TIMEOUT] || 1000 * 30;
const proxyTimeout = req.headers[HEADER_TIMEOUT] || 1000 * 30;
this.proxy.web(req, res, {
Expand All @@ -162,6 +160,7 @@ export class Proxy implements IProxy {
private setParametersToReq(req: IRequest, id: string, filter: string) {
const filtersOptions: IRouteFilter[] = get(this.routeMap[id], 'filters', []);
const filterOptions = filtersOptions.filter(opt => opt.name === filter)[0];
req.proxy.parameters = filterOptions.parameters;
if (filterOptions)
req.proxy.parameters = filterOptions.parameters;
}
}

0 comments on commit cf4e64b

Please sign in to comment.