Skip to content

Commit

Permalink
fix: wrong url replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
geekdada committed Jun 15, 2020
1 parent 560059b commit 9d32521
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/gateway/src/app.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ export class AppController {
if (!req.url) {
throw new HttpException('BAD REQUEST', HttpStatus.BAD_REQUEST);
} else {
req.url = req.url.replace(/^\/proxy\/https:\/(\S)/, '/https://$1').replace(/^\/proxy\/http:\/(\S)/, '/http://$1');
req.url = req.url
.replace(/^(\/proxy)?\/https:\/{1,2}(.*)/, '/https://$2')
.replace(/^(\/proxy)?\/http:\/{1,2}(.*)/, '/http://$2');
proxy.emit('request', req, res);
}
}
Expand Down

0 comments on commit 9d32521

Please sign in to comment.