createProxy
createProxy(
input):object
Creates the site proxy. Its fetch serves the injected script at
SCRIPT_PATH, forwards everything else under MOUNT_PREFIX to
the tenant, and passes other requests to the site’s own server. For a GET
answered 200 with HTML, it reads the page’s content facts, asks decide,
and rewrites the page in one pass. When decide answers, the page is sent
with cache-control: private, no-store.
const proxy = createProxy({ env, adapter });export default { fetch: (request) => proxy.fetch(request) };Build it once and reuse it: settings are read at construction, and their warnings are reported once rather than on every request. With a required setting missing, it serves the script and passes every other request through unmodified.
Parameters
Section titled “Parameters”adapter
Section titled “adapter”Record<string, unknown>
Returns
Section titled “Returns”object
fetch: (
request) =>Promise<Response>
Parameters
Section titled “Parameters”request
Section titled “request”Request
Returns
Section titled “Returns”Promise<Response>