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

Split X-RTD-Version-Method header into two HTTP headers. #6907

Merged
merged 5 commits into from May 1, 2020

Conversation

humitos
Copy link
Member

@humitos humitos commented Apr 14, 2020

  • Version-Method reflects how the version slug was obtained:
    • external_domain: slug from external versions' domain (split after --)
    • url: slug was taken directly from the URL
  • Project-Method indicates how the project slug was obtained
    • rtdheader: X-RTD-SLUG header
    • subdomain: slug is the first part in the host before readthedocs.io
    • cname: slug is from a custom domain

humitos added 2 commits Apr 14, 2020
Split X-RTD-Version-Method header into two HTTP headers.

* Version-Method reflects how the version slug was obtained:
  * external_domain: slug from external versions' domain (split after --)
  * url: slug was taken directly from the URL
* Project-Method indicates how the project slug was obtained
  * rtdheader: X-RTD-SLUG header
  * subdomain: slug is the first part in the host before readthedocs.io
  * cname: slug is from a custom domain
@humitos humitos requested a review from ericholscher Apr 14, 2020
@ericholscher
Copy link
Member

@ericholscher ericholscher commented Apr 15, 2020

This seems technically correct, but I don't know if it's useful. Having one header for all of these seems like the best UX, I don't want to be returning a million headers, so I'd just rename it X-Project-Method if you care about it.

Copy link
Member

@ericholscher ericholscher left a comment

Thinking more about this, if we only send Version-Method on PR builds, I think thats fine 👍

if hasattr(request, 'cname'):
response['X-RTD-Version-Method'] = 'cname'
else:
response['X-RTD-Version-Method'] = 'url'
Copy link
Member

@ericholscher ericholscher Apr 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this line entirely and only send it on external_domain, that removes a lot of my issue with it.

Copy link
Member Author

@humitos humitos Apr 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't send this header from Proxito, how would be the NGINX config? Do we need to add an if there to avoid checking for this variable?

Copy link
Member

@ericholscher ericholscher Apr 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. I guess this is fine for now if we care, but I think for PR's, we know where the version came from, so I don't know if this is super useful. 🤷

readthedocs/proxito/views/mixins.py Outdated Show resolved Hide resolved
@humitos humitos merged commit ecab363 into master May 1, 2020
2 checks passed
@humitos humitos deleted the humitos/split-headers branch May 1, 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.

None yet

2 participants