Skip to content

Example: Traefik middleware

Stéphane Brunner edited this page Jun 18, 2025 · 1 revision

Updating the Example: Ingress with a Traefik middleware to add CORS headers.

This example will create a middle ware add attach it to the Ingress.

ingress:
  enabled: true

  # Traefik middleware
  traefikMiddleware:
    spec:
      headers:
        customResponseHeaders:
          Access-Control-Allow-Methods: 'GET, OPTIONS'
          Access-Control-Allow-Origin: '*'
          Access-Control-Allow-Headers: '*'
  # End Traefik middleware

  hostGroups:
    test:
      tls:
        enabled: true
      hosts:
        - test.camptocamp.com

services:
  deployment1:
    enabled: true
    ingress:
      enabled: true
      path: /
    service:
      servicePort: 80
      ports:
        - port: 80
          targetPort: http
          protocol: TCP
          name: http
    containers:
      container1:
        image:
          repository: camptocamp/image
          tag: latest
        ports:
          http:
            containerPort: 8080
            protocol: TCP

Clone this wiki locally