-
Notifications
You must be signed in to change notification settings - Fork 274
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
PHP CORS Proxy #1546
Merged
Merged
PHP CORS Proxy #1546
Conversation
This file contains 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
Work in progress. To integrate [git clone](https://adamadam.blog/2024/06/21/cloning-a-git-repository-from-a-web-browser-using-fetch/) via `fetch()`, we need a CORS proxy. This PR explores an implementation. Assumptions: * It will run on a separate hostname – ideally not even a subdomain * No auth headers should make it through either way * No requests to private IPs * Stream data both ways, don't buffer Remaining work: * For now, refuse to process non-GET non-POST non-OPTIONS requests * Refuse to process POST request body larger than, say, 100KB * Refuse to process responses larger than, say, 100MB * Smart rate limiting * Support for query args * More unit tests See #1467
bgrgicak
reviewed
Jul 9, 2024
I'll go ahead and merge. I'm happy to revisit if you have more feedback @brandonpayton @bgrgicak |
Has this proxy been setup in production for public use yet? Doesn't seem so. |
@asirota not yet, @brandonpayton is looking into that. It will first be limited just to |
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.
Description
Ships a PHP-based CORS proxy we'll need to integrate git clone via
fetch()
.Usage
dev.sh
to start a local server, then go tohttp://127.0.0.1:5263/proxy.php/https://w.org/
and confirm it worked.http://127.0.0.1:5263/proxy.php/https://w.org/?test=1
to get the response fromhttps://w.org/?test=1
plus the CORS headers.Technical Design
Assumptions:
playground-proxy.wordpress.net
. Do not use a subdomain, likeproxy.playground.wordpress.net
.Follow-up work
playground-proxy.wordpress.net
.Testing instructions
dev.sh
to start a local server, then go tohttp://127.0.0.1:5263/proxy.php/https://w.org/
and confirm it worked.test.sh
to run PHPUnit tests, confirm they all pass.See #1467