-
-
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
APIv3: proxy these URLs to be served from El Proxito /_/api/v3/
#11831
base: main
Are you sure you want to change the base?
Conversation
humitos
commented
Dec 9, 2024
- Related: API: consider using APIv3 standard endpoints addons#356
- Related: API: use APIv3 endpoint for resources addons#468
api_proxied_urls = [ | ||
path("embed/", ProxiedEmbedAPI.as_view(), name="embed_api_v3"), | ||
path("search/", ProxiedSearchAPI.as_view(), name="search_api_v3"), | ||
] | ||
|
||
urlpatterns = api_proxied_urls | ||
urlpatterns += router.urls |
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 know Santos had some worried about handling modifications here. This seems like a pretty large change?
Santos mentioned:
We can cache content over docs domains (assuming we only expose read-only resources, and on .org only).
And this doesn't seem to restrict any of those things? In particular, we need to remove auth from these API endpoints (
readthedocs.org/readthedocs/core/mixins.py
Lines 25 to 27 in bb2aca3
# 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.
Yes. I haven't jumped into read-only endpoints / auth / cache yet because I wanted to be sure I'm moving in the right direction here before implementing those. If this POC is 👍🏼 -- we can start exploring how to achieve those goals as well.
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.
By the way, I understand we want auth here because .com will require authentication requests to return the correct data for those private projects.
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.
By the way, I understand we want auth here because .com will require authentication requests to return the correct data for those private projects.
Yea, looks like we're setting SessionAuthentication
explicitly on the Corporate side for the proxied APIs.
@@ -406,36 +354,6 @@ def _v1(self, project, version, build, filename, url, request): | |||
|
|||
data = { | |||
"api_version": "1", | |||
"projects": { |
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 worry a little bit about deleting this on deploy, since it will lead to a timing issue between the client & server. I'd probably just add the new fields to the existing API response, so we can test that appraoch without breaking old API clients during deploy?
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.
Yeah, it makes sense to deploy everything needed in the backend first without removing the old pattern 👍🏼