Commit 3c308a9
authored
Redirect libtorch zip downloads to download-r2.pytorch.org (#8021)
## Summary
- Adds a 301 redirect in the `pep503_whl_redirect` CloudFront Function
so that any request for a `/libtorch/**/*.zip` artifact on
`download.pytorch.org` is
redirected to the equivalent path on `download-r2.pytorch.org`.
- Index pages and folder listings under `/libtorch/` continue to be
served from the original origin — only the actual download artifacts
shift to R2.
- Example:
`https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-2.11.0+cpu.zip`
→
`https://download-r2.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-2.11.0+cpu.zip`.
## Test plan
- [ ] Validate function syntax with `aws cloudfront test-function`
against a sample
`/libtorch/cpu/libtorch-shared-with-deps-2.11.0+cpu.zip` event and
confirm a 301 with the expected `location` header.
- [ ] Test a folder-style URI (e.g. `/libtorch/cpu`) and confirm it
still rewrites to `/libtorch/cpu/index.html` (no redirect).
- [ ] Test a trailing-slash URI (e.g. `/libtorch/`) and confirm it still
rewrites to `/libtorch/index.html` (no redirect).
- [ ] Test a `/whl/...` request and confirm behavior is unchanged.
- [ ] After deploy + publish, curl a real libtorch zip URL and confirm
the 301 lands at `download-r2.pytorch.org` and the file downloads
successfully.1 parent 5d787cb commit 3c308a9
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
24 | 34 | | |
25 | 35 | | |
26 | 36 | | |
| |||
0 commit comments