Skip to content

Allow non-200 responses to satisfy served_by_pages #125

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

Merged
merged 4 commits into from
Apr 21, 2021

Conversation

tcbyrd
Copy link
Contributor

@tcbyrd tcbyrd commented Feb 25, 2021

This removes the hard requirement on getting an :ok response to satisfy served_by_pages, since there are cases where a non-200 response are still served by pages (e.g. private pages)

This removes the hard requirement on getting an `:ok` response to satisfy `served_by_pages, since there are cases where a non-200 response are still served by pages (e.g. private pages)
@tcbyrd tcbyrd requested a review from parkr February 25, 2021 22:12
@parkr
Copy link
Contributor

parkr commented Apr 14, 2021

A test for this would be cool 👍

@tcbyrd
Copy link
Contributor Author

tcbyrd commented Apr 21, 2021

Added tests for the cases I'm running into. I tried to some up with some extra conditionals that explicitly handled when the response code was 301 or 302, but that required getting at the raw http_response or https_response, which started turning into spaghetti code to make them all work in harmony. It did help me write some test cases, though, and verify that this one line change will basically get what we need, so I mocked out the responses we expect from an alternate domain and a private page response.

@tcbyrd
Copy link
Contributor Author

tcbyrd commented Apr 21, 2021

Note: since this follows redirects, the case of checking for :ok is actually fine for private pages, since the redirect goes to github.com, which also has Server: GitHub. The problem this is really going to solve is being able to separate when an alternate domain is properly setup to be served_by_pages?. Right now when the alternate is configured properly and the primary is not, we fail for both variants because the return_code is :couldnt_resolve_host after following the redirect to the primary. While we still consider it an invalid state when only the alternate domain is configured, it will help ensure we can push users in the right direction by being able to tell them the alternate is valid?: true, and it will work if they then setup the primary. Telling them both are invalid when the problem is only with the primary is a bit confusing.

@tcbyrd tcbyrd merged commit 982221e into master Apr 21, 2021
@tcbyrd tcbyrd deleted the non-200-served-by-pages branch April 21, 2021 22:01
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.

3 participants