[CORL-2872]: Add cors to single comment embed oembed endpoint #4297
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds cors to the oembed endpoint for single comment embeds.
(Permissions are still determined via site permitted domains, this just ensures that
Access-Control-Allow-Origin
header for the permitted requesting origin is included if those checks are passed.)These changes will impact:
What changes to the GraphQL/Database Schema does this PR introduce?
none
Does this PR introduce any new environment variables or feature flags?
no
If any indexes were added, were they added to
INDEXES.md
?n/a
How do I test this PR?
You can uncomment the example of the Oembed API at the bottom of
commentEmbed.html
(you'll need to edit to add a comment id where noted). Inspect in the network tab of dev tools and see that the response still works as expected.Also copy over to a test site and embed there (update fetch url and comment ids as needed). See that the comment embed response now includes the
Access-Control-Allow-Origin
header set to the correct origin for the permitted request. Remove your test site from the permitted sites list. See that now you get a 401 Unauthorized error as expected.Where any tests migrated to React Testing Library?
How do we deploy this PR?