mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-04-27 09:59:49 -05:00
Corrected a typo in the EPUB path in 'quarto/_redirects' and added missing redirect rules to both 'quarto/_redirects' and 'netlify.toml'. This ensures that the redirect behavior is consistent across both Netlify and direct GitHub Pages access, resolving discrepancies and improving robustness.
101 lines
2.5 KiB
TOML
101 lines
2.5 KiB
TOML
# =============================================================================
|
|
# NETLIFY PROXY CONFIGURATION FOR GITHUB PAGES
|
|
# =============================================================================
|
|
# This configuration proxies all requests to GitHub Pages while adding
|
|
# Netlify features like custom redirects, headers, and better performance.
|
|
#
|
|
# Flow: mlsysbook.ai → Netlify → GitHub Pages
|
|
# =============================================================================
|
|
|
|
# Custom redirects (processed BEFORE proxy)
|
|
[[redirects]]
|
|
from = "/kits"
|
|
to = "/contents/labs/kits.html"
|
|
status = 301
|
|
|
|
[[redirects]]
|
|
from = "/kits/"
|
|
to = "/contents/labs/kits.html"
|
|
status = 301
|
|
|
|
[[redirects]]
|
|
from = "/labs"
|
|
to = "/contents/labs/labs.html"
|
|
status = 301
|
|
|
|
[[redirects]]
|
|
from = "/labs/"
|
|
to = "/contents/labs/labs.html"
|
|
status = 301
|
|
|
|
[[redirects]]
|
|
from = "/pdf"
|
|
to = "/assets/downloads/Machine-Learning-Systems.pdf"
|
|
status = 301
|
|
|
|
[[redirects]]
|
|
from = "/pdf/"
|
|
to = "/assets/downloads/Machine-Learning-Systems.pdf"
|
|
status = 301
|
|
|
|
[[redirects]]
|
|
from = "/epub"
|
|
to = "/assets/downloads/Machine-Learning-Systems.epub"
|
|
status = 301
|
|
|
|
[[redirects]]
|
|
from = "/epub/"
|
|
to = "/assets/downloads/Machine-Learning-Systems.epub"
|
|
status = 301
|
|
|
|
[[redirects]]
|
|
from = "/changelog"
|
|
to = "/contents/frontmatter/changelog/changelog.html"
|
|
status = 301
|
|
|
|
[[redirects]]
|
|
from = "/changelog/"
|
|
to = "/contents/frontmatter/changelog/changelog.html"
|
|
status = 301
|
|
|
|
[[redirects]]
|
|
from = "/tinytorch"
|
|
to = "https://mlsysbook.github.io/TinyTorch/intro.html"
|
|
status = 301
|
|
|
|
[[redirects]]
|
|
from = "/tinytorch/"
|
|
to = "https://mlsysbook.github.io/TinyTorch/intro.html"
|
|
status = 301
|
|
|
|
# Proxy all other requests to GitHub Pages with cache-busting
|
|
[[redirects]]
|
|
from = "/*"
|
|
to = "https://harvard-edge.github.io/cs249r_book/:splat"
|
|
status = 200
|
|
force = true
|
|
headers = {X-Cache-Bust = "=1"}
|
|
|
|
# Security and performance headers
|
|
[[headers]]
|
|
for = "/*"
|
|
[headers.values]
|
|
X-Frame-Options = "DENY"
|
|
X-XSS-Protection = "1; mode=block"
|
|
X-Content-Type-Options = "nosniff"
|
|
Referrer-Policy = "strict-origin-when-cross-origin"
|
|
Cache-Control = "no-cache, no-store, must-revalidate"
|
|
Pragma = "no-cache"
|
|
Expires = "0"
|
|
|
|
[[headers]]
|
|
for = "*.pdf"
|
|
[headers.values]
|
|
Content-Type = "application/pdf"
|
|
Cache-Control = "public, max-age=86400"
|
|
|
|
[[headers]]
|
|
for = "*.epub"
|
|
[headers.values]
|
|
Content-Type = "application/epub+zip"
|
|
Cache-Control = "public, max-age=86400" |