Skip to content
agentgateway has joined the Agentic AI Foundation — Learn more

For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.

SSL Redirect

Page as Markdown

Convert NGINX SSL redirect annotations to Gateway API HTTP redirect filters.

The ssl-redirect annotation tells NGINX to redirect HTTP to HTTPS. In Gateway API, this becomes a RequestRedirect filter on the HTTPRoute. The referenced TLS Secret must exist in the same namespace as the generated Gateway.

Before: Ingress with SSL redirect

cat <<'EOF' > ssl-redirect-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ssl-redirect-demo
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
  ingressClassName: nginx
  tls:
  - hosts:
    - secure.example.com
    secretName: secure-example-tls
  rules:
  - host: secure.example.com
    http:
      paths:
      - backend:
          service:
            name: web-app
            port:
              number: 8080
        path: /
        pathType: Prefix
EOF

Convert

ingress2gateway print --providers=ingress-nginx --emitter=agentgateway \
  --input-file ssl-redirect-ingress.yaml > ssl-redirect-agentgateway.yaml

After: HTTPRoute(s) with redirect

cat ssl-redirect-agentgateway.yaml

In v0.5.0, the provider generates an HTTP redirect route with a RequestRedirect filter (308 to HTTPS) and no backends. A separate HTTPS route carries the backend traffic. Shown below is the HTTP redirect route:

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: ssl-redirect-demo-secure-example-com-http
spec:
  hostnames:
  - secure.example.com
  parentRefs:
  - name: nginx
    port: 80
  rules:
  - matches:
    - path:
        type: PathPrefix
        value: /
    filters:
    - type: RequestRedirect
      requestRedirect:
        scheme: https
        statusCode: 308

Note

The generated redirect preserves NGINX’s default status code of 308.

Apply

kubectl apply -f ssl-redirect-agentgateway.yaml
Was this page helpful?
Agentgateway assistant

Ask me anything about agentgateway configuration, features, or usage.

Note: AI-generated content might contain errors; please verify and test all returned information.

Tip: one topic per conversation gives the best results. Use the + button in the chat header to start a new conversation.

Switching topics? Starting a new conversation improves accuracy.
↑↓ navigate ↵ select esc dismiss

What could be improved?

Your feedback helps us improve assistant answers and identify docs gaps we should fix.

Need more help? Join us on Discord: https://discord.gg/y9efgEmppm

Want to use your own agent? Add the Solo MCP server to query our docs directly. Get started here: https://search.solo.io/.