GrowthBook Edge App for other providers alpha
Overview
GrowthBook currently supports two levels of integration with most edge workers:
-
Our turnkey Edge App
- Automatically run server-side or hybrid Visual Experiments without redraw flicker.
- Automatically run server-side or hybrid URL Redirect Experiments without flicker or delay.
- Perform custom feature flagging and experimentation logic.
- Optionally inject the JavaScript SDK with hydrated payload, allowing the front-end to pick up where the edge left off without any extra network requests. We use an enhanced version of our HTML Script Tag for this purpose.
-
Support for edge apps using our JavaScript SDK
References
- Our base Edge App repository, which supports the above use cases, is here
- You may find it useful to review our JavaScript SDK. Many of the concepts which apply to both on-edge and injected frontend SDKs are based on our JS SDK.
Turnkey Edge App
Our Edge App runs as a smart proxy layer between your application and your end users. In absence of Visual or URL Redirect experiments, the Edge App will simply proxy the user request to your site and return the response, optionally injecting a fully-bootstrapped JavaScript SDK onto the rendered HTML page. If the request URL matches an Visual or URL Redirect experiment and the targeting conditions are satisfied, the Edge App may also perform one or more URL redirects behind the scenes (the public-facing URL does not change) and/or mutate the DOM for Visual Experiments. Additionally, by using lifecycle hooks you can perform custom logic such as feature flagging as well as proxying and early returns.
The Edge App defaults to running URL Redirect Experiments in the browser only. This is because edge redirects load a separate page's content without altering the URL. After the redirect, some sites may experience problems with loading assets or endpoints with relative paths.
You can enable URL Redirects on edge by setting environment variable RUN_URL_REDIRECT_EXPERIMENTS
to "edge" or "everywhere".
Additionally if your redirect is cross-domain (e.g. redirection from "public.mysite.io" to "newsite.io"), you must also set RUN_CROSS_ORIGIN_URL_REDIRECT_EXPERIMENTS
.
See environment variables for more information.
Setting up our turnkey Edge App is usually simple for most JavaScript-based edge workers.
In this guide we do not discuss bootstrapping your project, but rather how to implement our Edge App once you have a basic edge worker environment set up.