- login to Foleon
- go to "Domains" in the Admin Console (or your workspace)
- Use HTTPS protocol to ensure End to End encryption
- Click "Create new Domain"
- Fill in the domain
- Click the checkbox for reverse proxy
- (optional) enter your certificate details
- Click "save"

We will create a small background script (Worker) that invisibly retrieves content from Foleon when a user visits your chosen path.
- Log in to your Cloudflare Dashboard.
- In the left sidebar, click "Workers & Pages".
- Click the blue "Create Application" button.
- Click "Create Worker".
- Name the worker foleon-proxy (or similar) and click "Deploy".
- Click "Edit Code".
Delete all existing code in the left-hand editor and paste the code block below exactly as is:
export default {
async fetch(request, env) {
const sourceUrl = new URL(request.url);
const targetOrigin = env.FOLEON_TARGET; // "https://s1.us.foleon.com" OR "https://s1.foleon.com"
const targetUrl = new URL(`${sourceUrl.pathname}${sourceUrl.search}`, targetOrigin);
const forwardedHost = env.PUBLIC_HOST || sourceUrl.hostname;
const newHeaders = new Headers(request.headers);
newHeaders.set("X-Forwarded-Host", forwardedHost);
newHeaders.set("X-Forwarded-Proto", "https");
const newRequest = new Request(targetUrl, {
method: request.method,
headers: newHeaders,
body: request.body,
redirect: "manual"
});
try {
return await fetch(newRequest);
} catch (e) {
return new Response("Proxy Error: " + e.message, { status: 502 });
}
}
}By default, the script works automatically. However, you can add Environment Variables if you need to override the host (e.g., if you are testing on a staging URL but want to load production content).
- Go back to the Worker overview page (click the < arrow in the top left).
- Go to the Settings tab > Variables.
- Under Environment Variables, click Add Variable to set the following:
| Variable Name | Value Example | Description |
|---|---|---|
| PUBLIC_HOST | yourdomain.com | (Optional) Forces a specific domain to be sent to Foleon. Useful if testing on workers.dev URLs. |
| FOLEON_TARGET | https://s1.foleon.com | REQUIRED Change the destination server. US: https://s1.us.foleon.com EU: https://s1.foleon.com |
Now we need to tell Cloudflare to use this script only for your specific folder (e.g., /publications/), leaving the rest of your site untouched.
- Go back to the "Workers & Pages" dashboard and click on your new "foleon-proxy" worker (or what you've called the worker).
- Click the Settings tab near the top.
- Add a domain under section "Domains & Routes"
- Choose "Route"
- Zone: Select your main domain (e.g., yourdomain.com).
- Route: Enter the path you want to use followed by
/*.- Example:
yourdomain.com/publications/* - IMPORTANT: Ensure you include the
www.if your site uses it.
- Example:
- Click Add Route.
Login to foleon.
Go to project settings.
Select the newly created domain.
Setup the basepath / subfolder you want to use to publish your documents on.
Make sure to publish a document in this project.
You can setup multiple projects with the same basepath. e.q. /en/guide/finance/ and /en/guide/legal/