Skip to content

Commit 24e7a54

Browse files
committed
Document smart placement with assets impact
1 parent 72684c6 commit 24e7a54

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/content/docs/workers/static-assets/binding.mdx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
pcx_content_type: concept
3-
title: Configuration and binding
3+
title: Configuration and Bindings
44
sidebar:
55
order: 7
66
head: []
@@ -133,3 +133,23 @@ export default {
133133
## Routing configuration
134134

135135
For the various static asset routing configuration options, refer to [Routing](/workers/static-assets/routing/).
136+
137+
## Smart Placement
138+
139+
[Smart Placement](/workers/configuration/smart-placement/) can be used to place a Worker's code close to your back-end infrastructure. Smart Placement will only have an effect if you specified a `main`, pointing to your Worker code.
140+
141+
### Smart Placement with serve_directly=false
142+
143+
If you desire to run your [Worker code ahead of assets](/workers/static-assets/routing/#invoking-worker-script-ahead-of-assets) by setting `serve_directly=false`, all requests must first travel to your Smart-Placed Worker. As a result, you may experience increased latency for asset requests.
144+
145+
Use Smart Placement with `serve_directly=false` when you need to integrate with other backend services, authenticate requests before serving any assets, or if your want to make modifications to your assets before serving them.
146+
147+
If you want some assets served as quickly as possible to the user, but others to be served behind a smart-placed Worker, considering splitting your app into multiple Workers and [using service bindings to connect them](/workers/configuration/smart-placement/#best-practices).
148+
149+
### Smart Placement with serve_directly=true
150+
151+
Enabling Smart Placement with `serve_directly=true` lets you serve assets from as close as possible to your users, but moves your Worker logic to run most efficiently (such as near a database).
152+
153+
Use Smart Placement with `serve_directly=true` when prioritizing fast asset delivery.
154+
155+
This will not impact the [default routing behavior](/workers/static-assets/routing/#default-behavior).

0 commit comments

Comments
 (0)