Repository navigation
Conversation
Adjusts setupFetchNetworkTransport() to funnel all PHP-sourced network requests through the CORS proxy. This is intentionally not adding that logic to the `fetch` event handler in the service worker, as that would also affect all the cross-origin `fetch()` requests initiated by JavaScript shipped with WordPress plugins. ## Changes in this PR * Adds a `corsProxyUrl` option to `setupFetchNetworkTransport()` * Adds the constants required by the CORS proxy to run in the local dev setup * Configures the CORS proxy to provide the Access-Control-Allow-Origin headers in the local setup where it's running on a different host. ## Concerns * Is it too permissive? * I built this to turn Playground into an RSS reader with @akirk's Friends plugins. It can fetch the list of feeds as expected, but then it usess SimplePie to parse the feeds and that requires curl which we don't provide in the web version of Playground. #1093 is a blocker for that. Until that's resolved, I'm not compelled to prioritize this. ## Testing changes TBD
| @@ -0,0 +1,4 @@ | |||
| <?php | |||
|
|
|||
| define('PLAYGROUND_CORS_PROXY_DISABLE_RATE_LIMIT', true); | |||
Member
There was a problem hiding this comment.
Thank you for accounting for the dev setup, @adamziel. This is something I missed when adding rate-limiting.
Closed
Collaborator
Author
|
Superseded by #2076 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adjusts setupFetchNetworkTransport() to funnel all PHP-sourced network requests through the CORS proxy.
This is intentionally not adding that logic to the
fetchevent handler in the service worker, as that would also affect all the cross-originfetch()requests initiated by JavaScript shipped with WordPress plugins.Related to #85
Changes in this PR
corsProxyUrloption tosetupFetchNetworkTransport()Concerns
Testing changes
TBD
cc @brandonpayton