You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: advanced/subpath/cloudflare.mdx
+59-2Lines changed: 59 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Cloudflare worker.
14
14
</Frame>
15
15
16
16
<Warning>
17
-
Keep in mind: If your DNS provider is Cloudflare you should not use proxying for the CNAME record
17
+
Keep in mind: If your DNS provider is Cloudflare you should not use proxying for the CNAME record.
18
18
</Warning>
19
19
20
20
### Add custom domain
@@ -74,11 +74,68 @@ async function handleRequest(request) {
74
74
returnawaitfetch(proxyRequest);
75
75
}
76
76
} catch (error) {
77
-
//if no action found, play the regular request
77
+
//If no action found, play the regular request
78
78
returnawaitfetch(request);
79
79
}
80
80
}
81
81
```
82
82
83
83
Click on `Deploy` and wait for the changes to propagate (it can take up to a few
84
84
hours).
85
+
86
+
### Routing multiple origins
87
+
88
+
If you're using a website builder, like Webflow or Squarespace, or another hosting provider for your main site and want to host your docs at a `/docs` subdirectory:
89
+
1. Set up a staging domain for your main site like `staging.yoursite.com`.
90
+
2. Update any absolute URLs in your main site to be relative.
91
+
3. Use the enhanced worker script below that routes between both origins.
92
+
93
+
<Warning>
94
+
Make sure your main site is set up on a staging domain before deploying this worker, or visitors to your main site will see errors.
0 commit comments