Closed nonrational closed 2 years ago
Ok so I started looking into this briefly and I realized that in my previous comment I was wrong about the functionality described by the README in 3f601b07d762074b2d9c21f303309cfc183354fd being related to the test in 2aed6eeb372a2223a3f5d9cf49cbc11e3e98ac41 Edit: After revisiting this I think I was right to conclude originally that those commits are related. It's important to be able to strip the TLD off of Host
headers that use subdomains as a prerequisite for being able to use subdomains at all (whether the subdomain points to a distinct app from the main domain or not)
The subdomain functionality as described by 3f601b07d762074b2d9c21f303309cfc183354fd doesn't appear to have any test coverage. Its implementation is in Http.findApp
here: https://github.com/puma/puma-dev/blob/06bb09ed93920e9b593314c4c36323fc62a42310/dev/http.go#L82-L94
My WIP branch is here: https://github.com/puma/puma-dev/compare/master...cjlarose:test-subdomain-support
I basically just moved the function over to AppPool
since that seemed like a more appropriate place for it to live (open to feedback on this), but also tried to make it easier to add unit tests. That's what I'll try to look into adding next.
Opened #289 to add tests for the behavior described in 3f601b07d762074b2d9c21f303309cfc183354fd
I took a look also at the test from 2aed6eeb372a2223a3f5d9cf49cbc11e3e98ac41, but it's not clear to me actually how it passed previously. My expectation would be that, given the configured TLD .co.test
, the domain subdomain.confusing-riddle.co.test
should be stripped to subdomain.confusing-riddle
, not just confusing-riddle
.
Thanks @cjlarose.
That test never passed. I added it to try to ensure we didn't introduce a regression with the new TLD pruning. But, wasn't able to get it to pass and just removed it, incorrectly assuming that the behavior was broken. Turns out the behavior is just fine, but exists elsewhere.
Ok that makes sense! Thanks for clarifying @nonrational
foo.hipuma.test
,bar.hipuma.test
, andhipuma.test
should all resolve tohipuma
.