-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
BYODomains: Prevent redirect loop on subdomains #1085
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It's unclear why, but my best guess is that the CNAME record and Cloudflare are doing some degree of domain rewriting or something and causing them to go back and forth forever. Logs for redirect loop here: ``` 2023-01-31T16:52:47.701120+00:00 heroku[router]: at=info method=GET path="/" host=piikup-sandbox.zinc.coop request_id=b946577a-5ea4-4e2b-9a37-4619b1225911 fwd="2601:643:8980:ebb0:19f1:1a52:9f91:7d5c,172.71.154.35" dyno=web.1 connect=0ms service=12ms status=302 bytes=562 protocol=http 2023-01-31T16:52:47.508025+00:00 heroku[router]: at=info method=GET path="/" host=piikup-sandbox.zinc.coop request_id=ff4c3f0b-4ebd-49ee-86ed-f6183666ed0a fwd="2601:643:8980:ebb0:19f1:1a52:9f91:7d5c,172.71.154.34" dyno=web.1 connect=0ms service=9ms status=302 bytes=562 protocol=http 2023-01-31T16:52:47.883575+00:00 app[web.1]: I, [2023-01-31T16:52:47.883484 #4] INFO -- : [a6829b90-5e64-456e-81bc-46d33cb82c62] Started GET "/" for 172.71.154.35 at 2023-01-31 16:52:47 +0000 2023-01-31T16:52:47.884565+00:00 app[web.1]: I, [2023-01-31T16:52:47.884511 #4] INFO -- : [a6829b90-5e64-456e-81bc-46d33cb82c62] Processing by SpacesController#show as HTML 2023-01-31T16:52:47.889728+00:00 app[web.1]: I, [2023-01-31T16:52:47.889668 #4] INFO -- : [a6829b90-5e64-456e-81bc-46d33cb82c62] Redirected to http://piikup-sandbox.zinc.coop/ 2023-01-31T16:52:47.889823+00:00 app[web.1]: I, [2023-01-31T16:52:47.889786 #4] INFO -- : [a6829b90-5e64-456e-81bc-46d33cb82c62] Filter chain halted as :ensure_on_byo_domain rendered or redirected 2023-01-31T16:52:47.889943+00:00 app[web.1]: I, [2023-01-31T16:52:47.889917 #4] INFO -- : [a6829b90-5e64-456e-81bc-46d33cb82c62] Completed 302 Found in 5ms (ActiveRecord: 0.8ms | Allocations: 1799) 2023-01-31T16:52:48.081439+00:00 app[web.1]: I, [2023-01-31T16:52:48.081354 #4] INFO -- : [4f58f081-5db8-4b0d-97bd-45919721aa85] Started GET "/" for 172.71.154.35 at 2023-01-31 16:52:48 +0000 2023-01-31T16:52:48.082541+00:00 app[web.1]: I, [2023-01-31T16:52:48.082479 #4] INFO -- : [4f58f081-5db8-4b0d-97bd-45919721aa85] Processing by SpacesController#show as HTML 2023-01-31T16:52:48.088904+00:00 app[web.1]: I, [2023-01-31T16:52:48.088816 #4] INFO -- : [4f58f081-5db8-4b0d-97bd-45919721aa85] Redirected to http://piikup-sandbox.zinc.coop/ 2023-01-31T16:52:48.088993+00:00 app[web.1]: I, [2023-01-31T16:52:48.088947 #4] INFO -- : [4f58f081-5db8-4b0d-97bd-45919721aa85] Filter chain halted as :ensure_on_byo_domain rendered or redirected 2023-01-31T16:52:48.089146+00:00 app[web.1]: I, [2023-01-31T16:52:48.089109 #4] INFO -- : [4f58f081-5db8-4b0d-97bd-45919721aa85] Completed 302 Found in 6ms (ActiveRecord: 1.4ms | Allocations: 1799) 2023-01-31T16:52:47.890252+00:00 heroku[router]: at=info method=GET path="/" host=piikup-sandbox.zinc.coop request_id=a6829b90-5e64-456e-81bc-46d33cb82c62 fwd="2601:643:8980:ebb0:19f1:1a52:9f91:7d5c,172.71.154.35" dyno=web.1 connect=0ms service=8ms status=302 bytes=562 protocol=http 2023-01-31T16:52:48.102702+00:00 heroku[router]: at=info method=GET path="/" host=piikup-sandbox.zinc.coop request_id=4f58f081-5db8-4b0d-97bd-45919721aa85 fwd="2601:643:8980:ebb0:19f1:1a52:9f91:7d5c,172.71.154.35" dyno=web.1 connect=0ms service=11ms status=302 bytes=562 protocol=http 2023-01-31T16:52:48.268890+00:00 app[web.1]: I, [2023-01-31T16:52:48.267750 #4] INFO -- : [9cb9c952-9c42-43e0-a6e6-c4d9aeddaf18] Started GET "/" for 172.71.154.35 at 2023-01-31 16:52:48 +0000 2023-01-31T16:52:48.268921+00:00 app[web.1]: I, [2023-01-31T16:52:48.268834 #4] INFO -- : [9cb9c952-9c42-43e0-a6e6-c4d9aeddaf18] Processing by SpacesController#show as HTML 2023-01-31T16:52:48.273483+00:00 app[web.1]: I, [2023-01-31T16:52:48.273433 #4] INFO -- : [9cb9c952-9c42-43e0-a6e6-c4d9aeddaf18] Redirected to http://piikup-sandbox.zinc.coop/ 2023-01-31T16:52:48.273549+00:00 app[web.1]: I, [2023-01-31T16:52:48.273524 #4] INFO -- : [9cb9c952-9c42-43e0-a6e6-c4d9aeddaf18] Filter chain halted as :ensure_on_byo_domain rendered or redirected 2023-01-31T16:52:48.273651+00:00 app[web.1]: I, [2023-01-31T16:52:48.273629 #4] INFO -- : [9cb9c952-9c42-43e0-a6e6-c4d9aeddaf18] Completed 302 Found in 5ms (ActiveRecord: 0.7ms | Allocations: 1799) ```
Turns out, being able to flip between debug and info is probably helpful to expose to Operators
Woops, I always get these wrong! A `host` is the full host-name, i.e. foo.bar.example.com; and a `domain` is just the TLD + the immediate preceding (i.e. `example.com`) Womp womp
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#74
Edit: TURNS OUT
request.host
andrequest.domain
are different!request.host
is the full host (i.e.foo.example.com
); whilerequest.domain
is just the tld + domain name (i.e.example.com
)It's unclear why, but my best guess is that the CNAME record and Cloudflare are doing some degree of domain rewriting or something and causing them to go back and forth forever.Logs for redirect loop here: