-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
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
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
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking more about this, if we only send Version-Method on PR builds, I think thats fine 👍
readthedocs/proxito/views/mixins.py
Outdated
if hasattr(request, 'cname'): | ||
response['X-RTD-Version-Method'] = 'cname' | ||
else: | ||
response['X-RTD-Version-Method'] = 'url' |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. 🤷