From 6c842308a5551785d76e51c1902f57774c8574ac Mon Sep 17 00:00:00 2001 From: Haimantika Mitra Date: Tue, 27 Feb 2024 16:41:57 +0530 Subject: [PATCH 1/2] Added further steps under Cloudflare --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index add4c6abe..4ad3beb3f 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,13 @@ Be sure to replace the values of `subpath` and `blogBaseUrl` in the above code s If your main domain is hosted elsewhere, you need to involve engineers from your team to create above rewrites. +After the above step is done, follow these steps to add the worker route: +- Go to `Websites` then click on your website and select `Worker Routes` from the left pane. +- Click on `Add route` and add `https://yourdomain/*` , then select the worker you just added above and click `Save`. +- Go to `https://yourdomain/yoursubpath` and now you should be able to see your blogs. + +Note: If you are updating your environment variables in Vercel, make sure to manually redeploy to see the changes. + ### Step 3 Now that you have deployed the starter kit on your own domain, you need to tell Hashnode not to generate a UI for your blog. You can do that by visiting your blog dashboard -> advanced tab. Scroll down and locate the section "use Hashnode as a headless CMS". Enable it and enter your blog base URL. From 462ea0871b945a99a368ae3cad680c4ccf8375ad Mon Sep 17 00:00:00 2001 From: Haimantika Mitra Date: Tue, 27 Feb 2024 16:55:40 +0530 Subject: [PATCH 2/2] Made changes --- README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4ad3beb3f..a0c44dca5 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,8 @@ async rewrites() { Once you deploy your project, the subpath installation should work successfully. +Note: If you are updating your environment variables in Vercel, make sure to manually redeploy to see the changes. + #### Cloudflare In case you are using Cloudflare in proxy mode (orange cloud on), you can deploy the following worker script and map it to `yourdomain.com/*`: @@ -122,17 +124,14 @@ async function proxyBlog(request) { } ``` - -Be sure to replace the values of `subpath` and `blogBaseUrl` in the above code snippet. This way cloudflare will proxy all the requests starting with `yourdomain.com/blog` to your headless blog, and other requests will hit your origin as usual. - -If your main domain is hosted elsewhere, you need to involve engineers from your team to create above rewrites. - After the above step is done, follow these steps to add the worker route: - Go to `Websites` then click on your website and select `Worker Routes` from the left pane. - Click on `Add route` and add `https://yourdomain/*` , then select the worker you just added above and click `Save`. - Go to `https://yourdomain/yoursubpath` and now you should be able to see your blogs. -Note: If you are updating your environment variables in Vercel, make sure to manually redeploy to see the changes. +Be sure to replace the values of `subpath` and `blogBaseUrl` in the above code snippet. This way cloudflare will proxy all the requests starting with `yourdomain.com/blog` to your headless blog, and other requests will hit your origin as usual. + +If your main domain is hosted elsewhere, you need to involve engineers from your team to create above rewrites. ### Step 3