Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update HOSTING docs #1015

Merged
merged 1 commit into from
Jan 14, 2025
Merged
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
12 changes: 6 additions & 6 deletions HOSTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,23 @@ CMD ["esmd", "--config", "/etc/esmd/config.json"]

## Deploy with CloudFlare CDN

To deploy the server with CloudFlare CDN, you need to create following cache rules in the CloudFlare dashboard, and each rule should be set to **"Eligible for cache"**:
To deploy the server with CloudFlare CDN, you need to create following cache rules in the CloudFlare dashboard (see [link](https://developers.cloudflare.com/cache/how-to/cache-rules/create-dashboard/)), and each rule should be set to **"Eligible for cache"**:

### 1. Cache `.d.ts` Files
#### 1. Cache `.d.ts` Files

```ruby
(ends_with(http.request.uri.path, ".d.ts")) or
(ends_with(http.request.uri.path, ".d.mts")) or
(ends_with(http.request.uri.path, ".d.cts"))
```

### 2. Cache Package Asset Files
#### 2. Cache Package Assets

```ruby
(http.request.uri.path.extension in {"node" "wasm" "less" "sass" "scss" "stylus" "styl" "json" "jsonc" "csv" "xml" "plist" "tmLanguage" "tmTheme" "yml" "yaml" "txt" "glsl" "frag" "vert" "md" "mdx" "markdown" "html" "htm" "svg" "png" "jpg" "jpeg" "webp" "gif" "ico" "eot" "ttf" "otf" "woff" "woff2" "m4a" "mp3" "m3a" "ogg" "oga" "wav" "weba" "gz" "tgz" "css" "map"})
```

### 3. Cache `?target=*`
#### 3. Cache `?target=*`

```ruby
(http.request.uri.query contains "target=es2015") or
Expand All @@ -139,7 +139,7 @@ To deploy the server with CloudFlare CDN, you need to create following cache rul
(http.request.uri.query contains "target=node")
```

### 4. Cache "/(target)/"
#### 4. Cache `/(target)/`

```ruby
(http.request.uri.path contains "/es2015/" and http.request.uri.path.extension in {"mjs" "map" "css"}) or
Expand All @@ -158,7 +158,7 @@ To deploy the server with CloudFlare CDN, you need to create following cache rul
(http.request.uri.path contains "/node/" and http.request.uri.path.extension in {"mjs" "map" "css"})
```

### 5. Bypass Cache for Deno/Bun/Node
#### 5. Bypass Cache for Deno/Bun/Node

```ruby
(not starts_with(http.user_agent, "Deno/") and not starts_with(http.user_agent, "Bun/") and not starts_with(http.user_agent, "Node/") and not starts_with(http.user_agent, "Node.js/") and http.user_agent ne "undici")
Expand Down
Loading