I am developing a web application on my desktop and it is running on port 80. I am able to access the application from my laptop connected to the LAN by entering my desktop's LAN IP address 192.168.1.8. Now, my application sends a redirect after login, but my laptop assumes the final address is localhost/login. If I manually type in the IP address and URI for any page, it shows that I am logged in, so it works as expected. So, why does the redirect assume localhost?
Both of my machines are linux-based. The laptop being Chrome OS. I am running nginx which proxies non-static file requests to jetty on port 8080.
$ cat /etc/hosts
127.0.0.1 locahost
192.168.1.8 desktop
$ hostname
desktop
The redirect is sent from Jetty, with a HttpServletResponse.sendRedirect()
TL;DR:
Laptop: Request http://192.168.1.8/login
Desktop: Respond with redirect to /index
Laptop: Redirect request to http://localhost/index
Requesting http://desktop/login doesn't work.