Skip to content

Commit

Permalink
Blueprints: Use ? instead of / to CORS Proxy URLs
Browse files Browse the repository at this point in the history
Makes GitDirectoryResource (introduced in #1858) relay the
requests through `/cors-proxy.php?{url}` instead of
`/cors-proxy.php/{url}`. This makes it compatible with the actual
`cors-proxy.php` script Playground ended up shipping.

 ## Testing instructions

None, this only works in production.
  • Loading branch information
adamziel committed Oct 15, 2024
1 parent b1a676d commit c93b589
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/playground/blueprints/src/lib/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export interface CompileBlueprintOptions {
*
* For example, if corsProxy is set to "https://cors.wordpress.net/proxy.php",
* then the CORS requests to https://github.com/WordPress/gutenberg.git would actually
* be made to https://cors.wordpress.net/proxy.php/https://github.com/WordPress/gutenberg.git.
* be made to https://cors.wordpress.net/proxy.php?https://github.com/WordPress/gutenberg.git.
*/
corsProxy?: string;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/blueprints/src/lib/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ export class GitDirectoryResource extends Resource<Directory> {

async resolve() {
const repoUrl = this.options?.corsProxy
? `${this.options.corsProxy}/${this.reference.url}`
? `${this.options.corsProxy}?${this.reference.url}`
: this.reference.url;
const ref = ['', 'HEAD'].includes(this.reference.ref)
? 'HEAD'
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export interface StartPlaygroundOptions {
*
* For example, if corsProxy is set to "https://cors.wordpress.net/proxy.php",
* then the CORS requests to https://github.com/WordPress/wordpress-playground.git would actually
* be made to https://cors.wordpress.net/proxy.php/https://github.com/WordPress/wordpress-playground.git.
* be made to https://cors.wordpress.net/proxy.php?https://github.com/WordPress/wordpress-playground.git.
*
* The Blueprints library will arbitrarily choose which requests to proxy. If you need
* to proxy every single request, do not use this option. Instead, you should preprocess
Expand Down

0 comments on commit c93b589

Please sign in to comment.