Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Managed Service for Kubernetes
  • Comparing with other Yandex Cloud services
  • Getting started
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
    • Overview
      • Overview
      • Gwin policies
      • Installing Gwin
      • Migrating apps from an ALB ingress controller to Gwin
      • Migrating applications from NGINX Ingress to Gwin
      • Attachment mechanism for Gwin integration with Application Load Balancer
        • DirectResponse
        • Gateway
        • BackendTLSPolicy
        • GatewayPolicy
        • GRPCRoute
        • HTTPRoute
        • Ingress
        • IngressBackendGroup
        • IngressPolicy
        • ListenerSetPolicy
        • RoutePolicy
        • Service
        • ListenerSet
        • ServicePolicy
        • YCCertificate
        • TLSRoute
        • YCStorageBucket
    • Configuring security groups
    • Working with service accounts
    • Creating and updating resources via ingress controller configurations
  • Release notes

In this article:

  • Cheatsheet
  • DirectResponseSpec
  • DirectResponseBody
  1. Application Load Balancer tools
  2. Gwin
  3. Resource configuration
  4. DirectResponse

DirectResponse

Written by
Yandex Cloud
Updated at July 3, 2026
View in Markdown
  • Cheatsheet
  • DirectResponseSpec
    • DirectResponseBody

DirectResponse is a Gwin custom resource that instructs the load balancer to return a fixed HTTP response directly to the client, without forwarding the request to any backend service.

It is referenced from an HTTPRoute rule via an ExtensionRef filter. This makes it conceptually similar to RequestRedirect — both are terminal route actions that short-circuit normal backend routing.

Typical use cases: returning 404 Not Found for unknown paths, 503 Service Unavailable during maintenance, or any other static response.

  • Cheatsheet
  • DirectResponseSpec
    • DirectResponseBody

CheatsheetCheatsheet

apiVersion: gwin.yandex.cloud/v1
kind: DirectResponse
metadata:
  name: not-found-response
  namespace: example-ns
spec:
  responseCode: 404          # HTTP status code to return
  responseBody:
    text: "Path not found"   # optional plain-text body

Reference from an HTTPRoute rule via ExtensionRef filter:

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: example-route
  namespace: example-ns
spec:
  parentRefs:
    - name: example-gateway
  rules:
    - matches:
        - path:
            type: PathPrefix
            value: /unknown
      filters:
        - type: ExtensionRef
          extensionRef:
            group: gwin.yandex.cloud
            kind: DirectResponse
            name: not-found-response  # must be in the same namespace as the HTTPRoute

Note

A rule that uses a DirectResponse filter must not include backendRefs — the direct response replaces normal backend routing entirely.

Field Description
metadata ObjectMeta
Standard Kubernetes metadata.
spec DirectResponseSpec
Direct response specification.

DirectResponseSpecDirectResponseSpec

DirectResponseSpec defines the HTTP response to be returned to the client.

Appears in: DirectResponse

Field Description
responseCode integer
HTTP status code to return.
Example: 404, 503.
responseBody DirectResponseBody
Optional response body. If omitted, the response has an empty body.

DirectResponseBodyDirectResponseBody

DirectResponseBody defines the plain-text content of the response body.

Appears in: DirectResponseSpec

Field Description
text string
Plain-text body content.
Example: Path not found

Was the article helpful?

Previous
Attachment mechanism for Gwin integration with Application Load Balancer
Next
Gateway
© 2026 Direct Cursus Technology L.L.C.