Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,21 @@ jobs:
mv build-raw/* "build/${BASE_URL}/"
rm -rf build-raw

- name: Generate cache headers
env:
BASE_URL: ${{ steps.env.outputs.base_url }}
run: |
printf '%s\n' \
"/${BASE_URL}/assets/*" \
" Cache-Control: public, max-age=31536000, immutable" \
"" \
"/${BASE_URL}/img/*" \
" Cache-Control: public, max-age=2592000" \
"" \
"/${BASE_URL}/*.js" \
" Cache-Control: public, max-age=31536000, immutable" \
> build/_headers

- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
Expand Down
1 change: 1 addition & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const config = {
: "https://www.marketdata.app/",

baseUrl: process.env.PROD == "true" ? "/docs/" : "/docs-staging/",
noIndex: process.env.PROD !== "true",
onBrokenLinks: "ignore",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon.ico",
Expand Down
2 changes: 0 additions & 2 deletions static/robots.txt

This file was deleted.

2 changes: 1 addition & 1 deletion worker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async function handleRequest(request) {
for (const route of ROUTES) {
if (matchesRoute(url.pathname, route.prefix)) {
url.hostname = route.target;
return fetch(new Request(url, request));
return fetch(new Request(url, request), { cf: { cacheEverything: true } });
}
}

Expand Down
2 changes: 2 additions & 0 deletions worker/wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ compatibility_date = "2024-01-01"
routes = [
{ pattern = "www.marketdata.app/docs-staging", zone_name = "marketdata.app" },
{ pattern = "www.marketdata.app/docs-staging/*", zone_name = "marketdata.app" },
{ pattern = "www.marketdata.app/docs", zone_name = "marketdata.app" },
{ pattern = "www.marketdata.app/docs/*", zone_name = "marketdata.app" },
]