How to host BlogHunch in a subdirectory with Cloudflare workers?

This guide will walk you through the steps to seamlessly link your BlogHunch website to a subfolder or subdirectory of your primary website managed by Cloudflare.

It's possible to set up a reverse proxy using Cloudflare Workers to establish a subdirectory on BlogHunch.

The use of Cloudflare Workers for a subdirectory setup is considered highly advanced and may require additional technical knowledge and troubleshooting.

Paste the exact configuration below into the Worker script area, updating each line as specified to meet our reverse proxy rules, and ensure that your setup references the subdirectory path you want to use (e.g. blog ).

  1. Visit cloudflare.com
  2. Login to your account.

  1. Once you are logged in, click on the Workers & Pages from the left-hand sidebar.

  1. Now click on Create Application from the top right of your Workers & Pages window.

  1. Now click on Create Worker.

  1. It will open a window with a form that contains the name of the Worker and the code preview of the demo Worker script. You can change the name here to something meaningful like blohunch-proxy.

  1. Scroll down to the end of the page and click on deploy to deploy the Cloudflare Worker.

  1. Once the Worker is deployed it will redirect to this page with the buttons to Configure Worker or Edit code. Click on Edit code.

  1. Now paste the code that you have found in the BlogHunch domain subdirectory settings and click the Save and Deploy button at the top right.

  1. Now it will ask for re-confirmation, whether you want to Save and deploy this code or not. Click Save and deploy to proceed.

  1. Now press the back button of your browser to get back to the Worker Overview page. From there click on the Triggers tab.

  1. Scroll down and click on the Add route option.

  1. Now enter the Route, choose the Zone, and click on the Add route button to connect the Cloudflare Worker to that specific route.

The Route will be - domain.com/subdirectory*

The Zone will be the domain.

In the above example, I want to connect my BlogHunch site to krenva.com/blog so I have chosen the Roue krenva.com/blog* and the Zone is krenva.com.

Now wait a couple of minutes and try accessing the website.

Note: This configuration has been tested and works with these exact settings if there are no conflicting top-level config issues.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us