Commit 768a74f
authored
Plugin proxy – handle artifacts hosted on windows.net (#889)
Fixes an issue reported by @gziolo:
> WordPress/gutenberg#57256 - I can’t preview
this PR using Playground
https://playground.wordpress.net/gutenberg.html. What do I miss? All CI
checks are green.
The culprit was that GitHub hosts that artifact on another domain:
`productionresultssa0.blob.core.windows.net`. The current
`file_get_contents` call follows the redirection URL and resends the
same HTTP headers. That used to be fine, but now the windows.net host
rejects those headers.
This PR ensures we don't implicitly follow the 302 redirect, but parse
the target URL and send an explicit request with a fresh set of HTTP
headers. As a bonus, this makes the download much faster as we now use
the `streamHttpResponse` function which immediately passes the response
bytes back to the browser instead of buffering the entire response
first.
This PR also switches from HEAD-request-based PR validation to the same
Query params–based one as the wordpress.html previewer uses.
## Testing instructions
Try to preview the above PR in the Gutenberg PR previewer on
https://playground.wordpress.net/gutenberg.html and confirm that it
works now (this fix is already deployed).1 parent 6302882 commit 768a74f
File tree
2 files changed
+17
-10
lines changed- packages/playground/website/public
2 files changed
+17
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
112 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
113 | 117 | | |
114 | | - | |
115 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
116 | 124 | | |
117 | 125 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
| 126 | + | |
| 127 | + | |
122 | 128 | | |
123 | 129 | | |
124 | 130 | | |
| |||
156 | 162 | | |
157 | 163 | | |
158 | 164 | | |
159 | | - | |
| 165 | + | |
160 | 166 | | |
161 | 167 | | |
162 | 168 | | |
163 | 169 | | |
164 | 170 | | |
165 | 171 | | |
166 | 172 | | |
| 173 | + | |
167 | 174 | | |
168 | 175 | | |
169 | 176 | | |
| |||
0 commit comments