#request.url has the wrong port number in vite dev mode
1 messages · Page 1 of 1 (latest)
if you only run one app at the same time, does the Remix app receives the correct port?
Nope still doesn't work. I tried running the Remix app and a separate non-Node non-Vite based static file server and inside of Remix's loaders the request.url.port was still incorrect.
I think I figured out the issue though.
My vite remix server is at port 5173. My other app is at port 2015. When I make a request from the second browser app to the remix server, here is what the request headers look like:
Host:
localhost:5173
Origin:
http://localhost:2015
In the remix server loader, request.url.port should be 5173, However, it looks like the remix vite dev adapter actually uses the origin header first, which has the wrong port.
I guess this makes sense for remix client <-> server communication because both the Host and Origin headers have the same port number so it wouldn't really matter. But if you have multiple apps on different servers only the Host header has the correct port.
I'm going to try to write up a proper bug report for this.