Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
found out, httpxy is ignoring the path
Browse files Browse the repository at this point in the history
  • Loading branch information
cs8898 committed Aug 26, 2023
1 parent c340c71 commit f15a35f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ Nitro stater sample, with devProxy
* `/foo` as entrypoint
* initialize directly on proxy creation (similar to nitro [dev/server.ts](https://github.com/unjs/nitro/blob/main/src/dev/server.ts#L259C1-L267C8))
2. add `/foo` to nitro devProxy
3. add `/bar` to httpxy_mre
* acutally httpxy is ignoring the path
* nitro is just dropping the path of the route
6 changes: 3 additions & 3 deletions httpxy_mre/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ const handleProxy2 = async (req, res) => {
const server = createServer(async (req, res) => {
if (req.url.startsWith("/api")) {
handleProxy(req, res)
} else if(req.url.startsWith("/foo")) {
} else if (req.url.startsWith("/foo") || req.url.startsWith("/bar")) {
handleProxy2(req, res);
}else{
} else {
res.statusCode = 200;
res.end("server_path: "+ req.url)
res.end(`server_path: ${req.url}`)
}
});
server.listen(3000, () => {
Expand Down

0 comments on commit f15a35f

Please sign in to comment.