Domain Setup

Serving your blog in the /subfolder of your main domain

Serving your blog via a /subfolder on your main domain is accomplished via Cloudflare Workers.

For this setup to work properly, your domain must run via Cloudflare. Please follow this guide on Setting up your domain in Cloudflare if you haven't already set up your domain in Cloudflare.

After you have set up your domain in Cloudflare, follow the instructions below and implement the required scripts for your blogstatic blog to run from your domain's /subfolder.


After setting up the /subfolder as described below, do not forget to check on "TLS/SSL" settings under your domain in Cloudflare. They need to be set in "Full" and Cloudflare tends to put them back to "Flexible" when nameservers resolve for the first time.

Feature Availability
The /subfolder feature is available on the "Expert" Plan or above. Please, view feature comparisons under the pricing page.


Cloudflare, from time to time, changes its flow. If the steps below do not match what you're seeing in Cloudflare, contact us and we'll help you out.

Setting up your /subfolder

  • Click on "Workers & Pages" > "Overview
  • From there, click the blue button "Create Worker"
    • On the next screen, give it a name
    • Paste the following code into the editor
      • For the "code" to show, you have to be logged in and have your /subfolder domain already set under "Settings > Domain > /subfolder"
    • Click "Deploy"
  • On your newly created Worker, click "Configure Worker"
  • On the next page, click on the "Triggers" tab
    • Click "Add Route"
    • Insert yourdomain.com/blog* for the route — do not forget the *
      • blog must match your /subfolder of choice
      • If you are setting up your /subfolder with "www" — add "www" in front of "yourdomain.com/blog*"
    • Select Zone yourdomain.com
    • Also, click on the "Request limit failure mode" link and select "Fail open (proceed)"
      • This makes the URL /blog resolve to the homepage of yourdomain.com if you exceed the 100K requests per day

Give it a few seconds, and visit yourdomain.com/blog. It should show the content from subdomain.bstatic.io

Setting up other functions

When your blog runs via Cloudflare Workers on your domain's /subfolder, we need to implement another script, so other functions (like newsletter signup, etc.) on your blog work properly.

  • Click on "Workers & Pages" > "Overview
  • From there, click the blue button "Create Worker"
    • On the next screen, give it a name
    • Paste the following code into the editor
      • For the "code" to show, you have to be logged in and have your /subfolder domain already set under "Settings > Domain > /subfolder"
    • Click "Deploy"
  • On your newly created Worker, click "Configure Worker"
  • On the next page, click on the "Triggers" tab
    • Click "Add Route"
    • Insert yourdomain.com/blog/internal/function for the route
      • blog must match your /subfolder of choice
      • If you are setting up your /subfolder with "www" — add "www" in front of "yourdomain.com/internal/function"
    • Select Zone yourdomain.com
    • Leave "Request limit failure mode" as is

Troubleshooting

  • Make sure you have set up your /subfolder under "Settings > Domain > /subfolder" in the blogstatic Dashboard.
  • If you are just moving your domain to Cloudflare, you must give it up to 48–hours for the new Nameservers to resolve globally. Usually, it takes less than that (2, 3 hours). But, that is the maximum that it can take.
  • Make sure the TLS/SSL on the domain level (in Cloudflare) is set to "Full". When Nameservers are resolving for the first time, Cloudflare tends to set back the TLS/SSL to flexible, which will not work.
  • The main domain needs to be proxied via Cloudflare (orange toggle) on DNS management.

For Carrd users

If your root domain runs through Carrd and even after setting everything up correctly on Cloudflare your blog still isn't working, contact Carrd support with the following request.

Hello,

I am setting up my blog with blogstatic on the /subfolder of my root domain and Triggers are not Routing to the Worker. Can you please change my IP to the non-Cloudflare one and let me know about any steps I need to take on my end?

Thank you.