Register a static transport
A static transport has:Content/ and refer to it through $PLUGIN_ROOT:
Bind a route to it
A route bound to a static transport carries the URL pattern and access policy:GET, or no method at all — declaring any other
specific method for a static route is rejected. See Routes and
transports for how a route and a transport relate in general.
Mount a directory
When the transport’ssource is a directory, its route’s pattern must end
in /:
/my-service/assets without the trailing slash is a different,
exact path; add a separate HTTP route through another transport if you need a
redirect or an index response there.
Mount a single file
When the transport’ssource is a single file, its route’s pattern must
not end in /:
/my-service/index.html/anything does not match this route.
The Kernel rejects the registration if the pattern’s trailing slash does not
match whether the source is a file or a directory, so this mismatch is caught
at registration time rather than surfacing as a runtime 404.
URL path rules
Static route patterns follow the Kernel’s shared path-pattern rules:- the pattern must be an absolute path beginning with
/; - a pattern without a trailing
/matches one exact path (single-file source); - a pattern ending in
/matches that path subtree (directory source); and /*is not a wildcard form and is rejected.
/ is treated as a subtree for a directory-backed static
route, and can match all absolute request paths. Avoid claiming the root
unless the service is intended to provide the application’s general static
content.
Access control
The route’saccess policy applies before the Kernel serves the file. A
request must also satisfy the service-wide access policy configured for the
service. If either policy rejects the request, the file is not served. See
Access control for the policy model.
Conflicts and matching
Static routes share the application’s URL space with a service’s other HTTP routes, whatever transport backs them. Keep each service’s patterns unique. The Kernel rejects a route when another service already owns the same path, and a static route always conflicts with a non-static route at the same path — a path is either served as static content or handled dynamically, not both. See Routes and transports for the complete conflict rules. When multiple routes can match a request, the longest matching pattern wins. A static route also wins when it has the same match length as a dynamically-handled route. Choose specific patterns to avoid surprising ownership of a URL.Packaging checklist
Before loading the service, verify that:- every static transport’s
sourceis inside the package’sContent/tree; - the
sourcevalue uses$PLUGIN_ROOTrather than a build-machine path; - directory-backed routes end their pattern in
/; - file-backed routes do not end their pattern in
/; and - the package contains all files referenced by the transports.