Skip to content

LocalReplyConfig Body Rewrite Generates Null Bytes in Cilium Envoy #1735

@YumeAyai

Description

@YumeAyai

When using Cilium Envoy's LocalReplyConfig for response body rewriting, configuring body with inline_string content results in the response body containing null bytes (0x00) equal in length to the specified string, rather than the expected text content.

Cilium Version:1.18.6
Kubernetes Version: 1.29.9

local_reply_config:
  mappers:
  - filter:
      status_code_filter:
        comparison:
          op: EQ
          value:
            default_value: 404
    body_format_override:
      text_format: "Custom 404: %REQ(:path)% not found"
  body_format:
    text_format: "Default error: %RESPONSE_CODE%"

Expected Behavior
When the configured status code (e.g., 404) is triggered, the response body should contain the configured custom text message.

Actual Behavior
The response body contains null bytes (0x00) equal in length to the configured string. For example:

Configured string: "Custom 404: /api not found" (24 characters)

Actual response: 24 null bytes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions