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

Allow wildcard additional_hostnames, fixes #2391 #2393

Merged
merged 7 commits into from Sep 4, 2020

Conversation

rfay
Copy link
Member

@rfay rfay commented Jul 18, 2020

The Problem/Issue/Bug:

#2391 requests wildcards for additional_hostnames. I experimented with it and it was pretty easy. Here's a PR. It will need to be looked at much more closely later in the release cycle.

How this PR Solves The Problem:

  • Add finesse to validation to remove the "*." on front of additional_hostnames.
  • Consider whether this is "OK" to go in, since it doesn't work unless using DNS.
  • Needs test for wildcard.
  • Needs docs
  • Prevent simple "*", as that should be invalid. Validators should make sure empty string is not accepted.

Allow *. in validation - everything else seems to work at first blush.

Manual Testing Instructions:

Automated Testing Overview:

  • Needs test for wildcard

Related Issue Link(s):

Release/Deployment notes:

@rfay rfay linked an issue Jul 18, 2020 that may be closed by this pull request
@j6s
Copy link

j6s commented Jul 19, 2020

I checked out and built your branch locally to test it.

  1. Create an empty project (in my case I had an var_dump($_SERVER); in there to check the vars passed to PHP)
  2. Add a wildcard hostname (in my case *.ddev-test)
  3. Open in browser using different hostnames

Wildcard hostnames now seem to work when online and (as expected) not work when offline. I cannot determine what effects this change has on the rest of ddev but the wildcard part seems to work.

@j6s
Copy link

j6s commented Jul 19, 2020

Just out of curiosity I checked the following 2 things as well:

  • Wildcard in the middle of a hostname (e.g. foo.*.ddev-test)
    • Does not work, throws up the invalid hostname message. I wouldn't know what usecase would need this over a leading wildcard however
  • Only wildcard as additional_hostnames entry
    • This, surprisingly worked and now routes all ddev domains to my project. It may be a good idea to not allow just * as a hostname to prevent accidentally shadowing other projects to easily

Example wildcard only config:

additional_hostnames:
  - '*'

@rfay rfay added this to the v1.16 milestone Jul 21, 2020
@rfay rfay force-pushed the 20200718_wildcard_hostnames branch from e5e6822 to 6b6fec0 Compare August 11, 2020 00:29
@rfay rfay force-pushed the 20200718_wildcard_hostnames branch from 6b6fec0 to 7ed0f15 Compare August 31, 2020 23:12
@rfay rfay removed this from the v1.16 milestone Sep 1, 2020
@rfay rfay force-pushed the 20200718_wildcard_hostnames branch from 7ed0f15 to 84a848b Compare September 3, 2020 18:12
@rfay rfay merged commit 2ea1def into ddev:master Sep 4, 2020
@rfay rfay deleted the 20200718_wildcard_hostnames branch September 4, 2020 23:54
@rfay rfay mentioned this pull request Nov 7, 2020
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 this pull request may close these issues.

Wildcard subdomains / hostnames
2 participants