Skip to content

How modify Host header? #1154

Closed
Closed

Description

@ta2013

How can I modify the Host header ?

In Envoy, I am using:

route:
  cluster: backend_service
  host_rewrite_literal: "myurl.example.com"

What is the similar configuration in Sozu?

Activity

  1. FlorentinDUBOIS commented on Nov 15, 2024

    @FlorentinDUBOIS
    Collaborator

    Hello 👋,

    Glad to see that you are using Sōzu.
    To me, this feature is not configurable in Sōzu currently.
    you could not rewrite path or authority of a request.

  2. Wonshtrum commented on Nov 15, 2024

    @Wonshtrum
    Member

    This is similar to #1009.
    I would gladly work on a rewrite/redirect feature, but we must first define the scope and granularity to configure it.

  3. Wonshtrum commented on Dec 11, 2024

    @Wonshtrum
    Member

    Hi @ta2013,
    I am currently working on a URL rewriting feature and was wondering if a system like the one proposed in issue #1161 would meet your needs. Please let me know your thoughts!

  4. ta2013 commented on Dec 13, 2024

    @ta2013
    Author

    Thanks for the response. I realized my initial query had an error with the upstream configuration. Apologies for the confusion. I'll reach out if I need further clarifications. Appreciate your help!

  5. FlorentinDUBOIS commented on Apr 30, 2026

    @FlorentinDUBOIS
    Collaborator

    Addressed on main by per-frontend rewrite_host. Configure on a frontend like:

    [[clusters.MyCluster.frontends]]
    address = "0.0.0.0:80"
    hostname = "old.example.com"
    rewrite_host = "myurl.example.com"

    The on-wire Host: reaching the backend is rewritten to myurl.example.com; the original host is preserved on the request via X-Forwarded-Host so backends that need to reconstruct the original URL can read it there. Documented under doc/configure.md (Frontend redirect, URL rewrite, and custom headers section). This is the Sōzu equivalent of Envoy's host_rewrite_literal.

    Companions on the same shape:

    • rewrite_path — rewrite the URL path (analogous to Envoy's prefix_rewrite).
    • rewrite_port — rewrite the port carried in the Location: header on a permanent redirect.
    • $HOST[n] / $PATH[n] capture placeholders work inside rewrite_host / rewrite_path when the frontend's hostname or path is a regex (the n-th group is captured at lookup time).

    Closing as addressed.

  6. added a commit that references this issue on Apr 30, 2026
  7. added a commit that references this issue on Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions