+A Symfony application ships its CSS, JavaScript, images and fonts under its web root, and nothing in front of a Scaleway function serves them: every request reaches the Handler.
4
+We therefore let the runtime serve the files under the web root itself, before building the Application, so that a standard application works on Scaleway without extra infrastructure, and keep moving them to Object Storage as a later, optional step.
5
+
6
+## Considered Options
7
+
8
+- Uploading them to Object Storage, behind Edge Services or not, and pointing `asset()` to it: kept for later, as it needs a bucket, CORS settings and a deployment step before an application works at all.
9
+- Serving nothing and documenting Object Storage only: rejected, an unchanged application would answer its own stylesheets with 404s.
10
+
11
+## Consequences
12
+
13
+- Each Static File costs an Invocation, can hit a cold start, and its binary body grows by about a third once base64-encoded.
14
+- Its size is bounded by the largest Function Response the platform accepts.
15
+- Files written at runtime, such as user uploads, are only served by the instance that wrote them, each instance having its own ephemeral disk: they belong in Object Storage.
16
+- Only a file that a `manifest.json` above it maps from another name, as AssetMapper and Webpack Encore write them, is cached for good: a digest guessed from the name alone would also match plain names such as `font-awesome.css`, which would then stay stale in browsers for a year.
new file mode 100644
@@ -0,0 +1,16 @@
1
+# The function serves Static Files itself
2
+
3
+A Symfony application ships its CSS, JavaScript, images and fonts under its web root, and nothing in front of a Scaleway function serves them: every request reaches the Handler.
4
+We therefore let the runtime serve the files under the web root itself, before building the Application, so that a standard application works on Scaleway without extra infrastructure, and keep moving them to Object Storage as a later, optional step.
5
+
6
+## Considered Options
7
+
8
+- Uploading them to Object Storage, behind Edge Services or not, and pointing `asset()` to it: kept for later, as it needs a bucket, CORS settings and a deployment step before an application works at all.
9
+- Serving nothing and documenting Object Storage only: rejected, an unchanged application would answer its own stylesheets with 404s.
10
+
11
+## Consequences
12
+
13
+- Each Static File costs an Invocation, can hit a cold start, and its binary body grows by about a third once base64-encoded.
14
+- Its size is bounded by the largest Function Response the platform accepts.
15
+- Files written at runtime, such as user uploads, are only served by the instance that wrote them, each instance having its own ephemeral disk: they belong in Object Storage.
16
+- Only a file that a `manifest.json` above it maps from another name, as AssetMapper and Webpack Encore write them, is cached for good: a digest guessed from the name alone would also match plain names such as `font-awesome.css`, which would then stay stale in browsers for a year.
One first-party cookie so a repeat visit isn't counted twice. No cross-site tracking, nothing stored until you accept. Cookie Policy.