mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
The parsing in the redirects module was simply determining the base host via trimming off everything up to //, so a BASE_URL like "http://localhost:3000" will result in the host name "localhost:3000", which isn't a valid host name. So the problem here is that BASE_URL_HOST is used for determining whether the client should be redirected and it's comparing the hostname of the request object with BASE_URL_HOST. For example if we have the aforementioned BASE_URL, we get to the following comparison: req.hostname !== BASE_URL_HOST Which expands to: "localhost" !== "localhost:3000" So in order to get rid of the port number, we now use url.parse() to get the right host name. Signed-off-by: aszlig <aszlig@nix.build>