• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
NameHero® Blog

NameHero® Blog

Web Hosting Tips & Resources From NameHero

  • AI Agents
    • OpenClaw
    • Claude Code
    • n8n
    • Hermes Agent
    • Open WebUI
    • Docker
  • Hosting
    • Web Hosting
    • WordPress Hosting
    • WooCommerce Hosting
    • Enterprise Hosting
    • Email Hosting
    • HeroicGuard
    • GPU Hosting
    • Website Builder
  • VPS
    • Managed VPS
    • Unmanaged VPS
    • Flex VPS
  • Reseller
  • Gaming
  • Domains
  • Account
  • Blog Home
  • Categories
  • Authors

Use Cloudflare To Change Response Headers

Bhagwad Park

Published on: October 10, 2022

Categories: Website Performance 0

Response headers can be notoriously difficult to change. Particularly if you’re using a CMS like WordPress, it’s often a mystery where certain response headers are coming from. Cache-control is a great example of where many WordPress developers have torn their hair out in frustration, trying to figure out which plugin or .htaccess rule is setting it. Luckily, with Cloudflare, you can now easily change response headers for any subset of your URLs which just a few clicks.

Previously Used Workers to Set Response Headers

Before this tool became fully operational, I recommended Cloudflare workers to set response headers. A great use case was the X-Robots-Tag response header, which Google now requires for all “noindex” pages. I wrote an earlier tutorial on how to add an X-Robots-Tag response header to affiliate links using Cloudflare workers. This was the solution I used on my site WP-Tweaks.com.

Unfortunately, Workers came with some drawbacks. For one, you only got a limited number of worker calls for free. The free limit is generous, but you never know when you might hit the limit. The second (more serious) limitation is that the workers interfere with my bulk redirects, so I can either use workers for the X-Robots-Tag or give up Cloudflare’s bulk redirects.

But thanks to transform rules, I don’t need to make that choice anymore.

How to Use Cloudflare Transform Rules to Set Response Headers

To set the response header, transform rules on Cloudflare, log in and click “Rules,” and then Transform rules as shown here:

Cloudflare Transform Rules
Cloudflare Transform Rules

This will open the “Transform Rules” configuration screen, where you can modify the request headers, rewrite the URL, or change the response headers. We’re interested in the response headers, so click “Create Transform Rule” and choose “Modify Response Header,” as shown here:

Cloudflare Modify Response Header
Cloudflare Modify Response Header

In the response header modification screen, configure your response headers like this:

Adding an X-Robots-Tag Response Header with Cloudflare
Adding an X-Robots-Tag Response Header with Cloudflare

In the above screenshot, I’ve configured all affiliate links with the URL pattern “/recommends/” to have an X-Robots-Tag. I’ve used Cloudflare’s URI matching field to match a set of URLs and the “Set static” response header because I just need to set a simple value with no additional rules.

Save your changes, and you’re done!

Cloudflare Transform Rules Free Tier Limits

For the Cloudflare free tier, you get 10 free transform rules. This limit is more than enough for a free account, and it’s doubtful you’ll ever need to use more than that. Pro accounts get 25 rules. This includes request header changes and URL rewrites, but even so, it’s more than most websites need.

The benefit of using workers is that there’s no traffic limit to which these rules apply. As long as you stay below the total number of transform rules, you’re good, unlike with workers, where you need to keep an eye on the number of times they execute.

Use Transform Rules for cache-control As Well

I find using transform rules works well for complicated settings like cache control. Instead of using a WordPress plugin and adding to the burden of your site, just use Cloudflare’s transform rule for a set of websites, so you don’t need to worry about systems not caching your pages. I’d written earlier about the pros and cons of advertisements on your site. Ezoic is one of the most popular ad networks, and their systems won’t cache content to speed things up if you have an incorrectly configured cache-control or “Vary” header. You can use Cloudflare transform rules to solve all these problems.

Cloudflare keeps improving its products and offering new services. If QUIC.cloud aims to be a proper competitor, they’d better catch up fast!

Bhagwad Park Profile Picture
Bhagwad Park

I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow & Subscribe

Exclusive promos, content and more!


Most Popular Posts

NameHero’s Recommended WordPress Plugin and Theme Setup

WordPress Hosting vs. Web Hosting – What’s The Difference?

How To Increase The InnoDB Buffer Pool Size

How To Fix A Stuck All-in-One WP Migration Import

How To Add A Subdomain In Cloudflare

Top Categories

  • WordPress
  • WordPress Tutorials
  • OpenClaw Hosting
  • Enterprise Hosting
  • WooCommerce
  • Web Hosting
  • Resellers
  • Website Security
  • Website Development
  • Website Performance
  • VPS Hosting
  • SEO Tips
  • Announcements
  • Domain Registration
NameHero

NameHero® proudly provides web hosting to over 40,000 customers with 99.9% uptime to over 750,000 websites.

  • Master Card
  • Visa
  • American Express
  • Discover
  • Paypal
Products
  • Web Hosting
  • Managed VPS Hosting
  • Unmanaged VPS Hosting
  • Flex VPS Hosting
  • WordPress Hosting
  • WooCommerce Hosting
  • Reseller Hosting
  • Enterprise Hosting
  • GPU Hosting
  • Email Hosting
  • HeroicGuard
  • Domains
  • Website Builder
  • AI Agent Hosting
Help & Support
  • NameHero Blog
  • NameHero Gaming Blog
  • Support
  • Help Center
  • Migrations
  • Affiliates
  • Gaming Affiliates
  • Call 1-855-984-6263
Company
  • About Us
  • Contact Sales
  • Reviews
  • Uptime
  • We're Hiring

Copyright © 2026 Name Hero, LLC. All rights reserved.
NameHero® is a registered trademark.

  • Privacy Policy
  • Terms of Use
  • Acceptable Use Policy
  • Payment Policy
  • DMCA