vercel / serve-handler

The foundation of `serve`

Home Page:https://npmjs.com/serve-handler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

It's not possible to specify port on redirects

ShinaZin opened this issue · comments

I'm trying to redirect API call to my server listening on port 9443 like this.
My serve.json:

{
  "redirects": [
    { "source": "/api/get_info", "destination": "https://10.0.0.11:9443/api/get_info" },
  ]
}

Then I'm getting error from path-to-regexp:
UnhandledPromiseRejectionWarning: TypeError: Expected "9443" to be a string...
How can I do this?

It turned out to figure it out. Just added two slashes to escape the colon. Like this:

"https://10.0.0.11\\:9443/api/get_info"
                  ^^ - here