Files
cs249r_book/netlify.toml
Vijay Janapa Reddi 987b551759 feat(infra): Fix Netlify bandwidth issue and update navbar
- Change Netlify from proxy (status 200) to redirect (status 301)
- Reduces bandwidth costs from 100% to near-zero
- Netlify now only handles tiny redirect headers, GitHub Pages serves content
- Group Labs and Kits under 'Hands-on' dropdown in navbar
- Feature TinyTorch prominently as new release
- Add Newsletter subscribe button
- Group PDF and EPUB under 'Downloads' dropdown
- Cleaner navbar with better organization
2025-12-02 20:16:20 -05:00

100 lines
2.4 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://tinytorch.ai"
status = 301
[[redirects]]
from = "/tinytorch/"
to = "https://tinytorch.ai"
status = 301
# Redirect all other requests to GitHub Pages (no proxying = no bandwidth cost!)
[[redirects]]
from = "/*"
to = "https://harvard-edge.github.io/cs249r_book/:splat"
status = 301
force = true
# 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"