Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Change the way Express gets hostname #520

Closed
wants to merge 1 commit into from
Closed

Conversation

simison
Copy link
Member

@simison simison commented Apr 19, 2015

Getting host via req.get('host') instead of req.hostname.

get() methods adds also port if it's something else than 80.

Otherwise links that should be "localhost:3000" end up being just "localhost".

Getting host via req.get('host') instead of req.hostname. 

get() methods adds also port if it's something else than 80.

Otherwise links that should be "localhost:3000" end up being just "localhost".
@simison
Copy link
Member Author

simison commented Apr 19, 2015

On second thought, nope.

This would've been great for stuff like:
<link href="http://localhost:3000/modules/core/img/favicon.png" rel="shortcut icon" type="image/png" />

But I overlooked this:
<script type="text/javascript" src="http://localhost:3000:35729/livereload.js"></script>

I think on my own version I'll just pass separate hostPort and host parameters, but dunno what's the best for the boilerplate.

Sorry noise. :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant