Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

req.hostname doesn't reflect real hostname #230

Closed
jereaameli opened this issue Jan 19, 2021 · 1 comment · Fixed by #231
Closed

req.hostname doesn't reflect real hostname #230

jereaameli opened this issue Jan 19, 2021 · 1 comment · Fixed by #231

Comments

@jereaameli
Copy link

Bug

PR #224 introduced a feature where req.hostname get's calculated from the Host header, but it wrongly truncates it to the 2 upper domains.

For example:

  • example.com will continue being example.com
  • mercadolibre.com.ar will get truncated to .com.ar

Solution

req.hostname should reflect exactly the same value as the Host header, without the port information if it was included, and all subdomains must be included.

Reference

For reference, here we can see how Express calculates the hostname value.

eugef pushed a commit that referenced this issue Jan 20, 2021
Hostname includes full domain name with all the subdomains
If Hostname is predefined, then Host header is ignored (to prevent backwards-incompatible changes)

Fixes #230
eugef added a commit that referenced this issue Jan 20, 2021
Hostname includes full domain name with all the subdomains
If Hostname is predefined, then Host header is ignored (to prevent backwards-incompatible changes)

Fixes #230
@eugef
Copy link
Owner

eugef commented Jan 20, 2021

Hi @jereaameli, thank you for reporting the issue, the fix will be released in the next version

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

Successfully merging a pull request may close this issue.

2 participants