Open
Description
Reproduction
The remix-express/server tries to parse the port number from either the host
or the X-Forwarded-Host
header remix-express/server.ts#L92. In the case that one of them is an IPv6 address the code incorrectly identifies part of the ip address as port because it splits at colons and IPv6 addresses can contain colons.
I created an example here: https://stackblitz.com/edit/remix-run-remix-edjlfm?file=app%2Froutes%2F_index.tsx
The button fetches the current site but adds a custom X-Forwarded-Host
header to emulate a server environment. One should see that the request fails and the server logs an Invalid URL
error.
We noticed this error with our remix application behind a reverse proxy which does health checks using the internal IPv6 address.
System Info
stackblitz fork, latest packages
"@remix-run/node": "*",
"@remix-run/react": "*",
"@remix-run/serve": "*"
### Used Package Manager
npm
### Expected Behavior
The express server does work even if host or `X-Forwarded-Host` header is an IPv6 address.
### Actual Behavior
The express server throws an error because an invalid url is constructed.