-
-
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
Proxy footer api on docs' domains #6630
Proxy footer api on docs' domains #6630
Conversation
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.
This is a good start, but lets go ahead and start proxying everything we need for doc pages, and then we can adapt it later if needed.
from .views.proxied import ProxiedFooterHTML | ||
|
||
api_footer_urls = [ | ||
url(r'footer_html/', ProxiedFooterHTML.as_view(), name='footer_html'), |
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.
We should add search in here while we are updating it. Probably also the sustainability API for completeness.
|
||
# DRF has BasicAuthentication and SessionAuthentication as default classes. | ||
# We don't support neither in the community site. | ||
authentication_classes = [] |
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.
Is there a reason we don't want them to be present on the footer? Seems like it doesn't hurt anything to have them.
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.
Not strong reason on that I guess, I can add it back (or remove the line actually so it takes the defaults)
In proxito/serve app we don't have access to the urlconf from the main app. So we need to hardcode the urls, since this template is used in both apps (main and proxito). This is needed for readthedocs#6630
This is needed to reuse these tests for the proxied footer html - All calls to get are replaced for .render() so it can be overridden (`HTTP_HOST=self.host`). - The url isn't hardcoded - For some reason if the class is inherited, the fixtures don't work. So I just used django_dynamic_fixture. Ref readthedocs#6630
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.
Looks good once tests pass 👍 Feels pretty complex, so I'm excited to hopefully have this somewhat simplified in the future.
…ocs.org into proxi-api-on-docs-domain
…ocs.org into proxi-api-on-docs-domain
# the Corporate site we don't define this URL if ``-ext`` module is not | ||
# installed | ||
cls.url = reverse('doc_search') | ||
self.url = reverse('doc_search') |
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.
Tests were failing bc the tests for proxied api were using doc_search
from readthedocs.urls
for both classes, instead of evaluating it for each class.
@stsewd this PR doesn't change the URL the client code uses, are we planning to deploy that after we've confirmed the proxying works? |
Still need to add tests.
Also, since we are serving everything from proxito, I'm adding the proxied urls only there. This also allows us to override it from corporate.