---
title: Change the HTTP Host header · Cloudflare Rules docs
description: Create an origin rule to change the HTTP `Host` header.
source_url:
  html: https://bd468052.preview.developers.cloudflare.com/rules/origin-rules/examples/change-http-host-header/index.md
  md: https://bd468052.preview.developers.cloudflare.com/rules/origin-rules/examples/change-http-host-header/
---

The following origin rule overrides the HTTP `Host` header to `eu_server.example.net` for all requests containing `/eu/` in their URI path.

* Dashboard

  Text in Expression Editor:

  ```txt
  http.request.uri.path contains "/eu/"
  ```

  Value after **Host Header** > **Rewrite to**:

  ```txt
  eu_server.example.net
  ```

* API

  The following example sets the rules of an existing phase ruleset (`$RULESET_ID`) to a single origin rule — overriding the HTTP `Host` header — using the [Update a zone ruleset](https://developers.cloudflare.com/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated.

  ```bash
  curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/rulesets/$RULESET_ID" \
    --request PUT \
    --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
    --json '{
      "rules": [
          {
              "expression": "http.request.uri.path contains \"/eu/\"",
              "description": "My first origin rule",
              "action": "route",
              "action_parameters": {
                  "host_header": "eu_server.example.net"
              }
          }
      ]
    }'
  ```

  ```json
  {
    "result": {
      "id": "<RULESET_ID>",
      "name": "Origin Rules ruleset",
      "description": "Zone-level ruleset that will execute origin rules.",
      "kind": "zone",
      "version": "2",
      "rules": [
        {
          "id": "<RULE_ID>",
          "version": "1",
          "action": "route",
          "action_parameters": {
            "host_header": "eu_server.example.net"
          },
          "expression": "http.request.uri.path contains \"/eu/\"",
          "description": "My first origin rule",
          "last_updated": "2022-06-02T14:42:04.219025Z",
          "ref": "<RULE_REF>"
        }
      ],
      "last_updated": "2022-06-02T14:42:04.219025Z",
      "phase": "http_request_origin"
    },
    "success": true,
    "errors": [],
    "messages": []
  }
  ```
