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

Unable to use hostnames without domain name in request_host #1300

Closed
jarl-dk opened this issue Jun 9, 2016 · 3 comments
Closed

Unable to use hostnames without domain name in request_host #1300

jarl-dk opened this issue Jun 9, 2016 · 3 comments
Assignees
Labels
Milestone

Comments

@jarl-dk
Copy link

jarl-dk commented Jun 9, 2016

I have some practical hostnames in /etc/hosts. I want to configure kong to filter requests based on these hostnames (without a domain), so I configure kong with

curl -f -X POST \
  -F 'name=backend' \
  -F "upstream_url=http://backend:8080" \
  -F 'request_host=api-backend' \
'http://localhost:8001/apis/'

but when I do so I get

curl: (22) The requested URL returned error: 400 Bad Request

I have isolated the issue. The problem only occurs when request_host is given a host name that does not contain a . (dot) for subdomain separation.

I think this is an unnecessary limitation of the argument validation.

@Tieske
Copy link
Member

Tieske commented Jun 9, 2016

I think you're right. This is the offending line as it requires a ..

@Tieske Tieske self-assigned this Jun 9, 2016
@subnetmarco subnetmarco added this to the 0.9 milestone Jun 9, 2016
@Tieske
Copy link
Member

Tieske commented Jul 13, 2016

This also touches on the punycode again, see #1205 (comment) (i18n domain names)

so best of its fixed in one go.

@Tieske
Copy link
Member

Tieske commented Jul 13, 2016

will be in the next release. closing this.

@Tieske Tieske closed this as completed Jul 13, 2016
Tieske added a commit that referenced this issue Jul 14, 2016
* allows for `request_host` to have names without top level domain, eg. `localhost`, fixes #1300.

* allows for punycode encoded host/domainnames (RFC3492; https://tools.ietf.org/html/rfc3492)

fix #1300 and #1205 (comment)

NOTE: relaxes the parsing of host/domainnames to allow for punycode. It does not verify punycode, so invalid entries might be allowed in. But as it doesn't break Kong, it does imho not justify writing a punycode implementation just to prevent that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants