Nginx configuration: headers and ingress customization

Customize nginx settings including headers and other customization

Argonaut provisions ingress-nginx for managing ingress. This can be customized for specific application needs by just plugging in the services.external.extraAnnotations field in the service descriptor art.yaml file.

This can be done either using the CLI or the UI.

Example snippet in the service descriptor for changing the max body size in the request:

services:
  - port: 8080
    protocol: "tls-terminated"
    external:
      hosts:
        - "app.prod.example.com"
      paths: ["/"]
      extraAnnotations:
        nginx.ingress.kubernetes.io/proxy-body-size: 8m

This supports any annotations present here.

By default, some annotations are added such as an http -> https redirect. This can be eliminated and overridden by using the services.external.overrideAnnotations field. Example:

services:
  - port: 8080
    protocol: "tls-terminated"
    external:
      hosts:
        - "app.prod.example.com"
      paths: ["/"]
      overrideAnnotations:
        nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
        nginx.ingress.kubernetes.io/from-to-www-redirect: "true"

All headers are forwarded to the application by default. These headers are also forwarded to the application in addition to user set ones.
Note: enable-underscores-in-headers is disabled by default. That can be enabled as an extraAnnotation.

    X-Real-IP: $remote_addr
    X-Forwarded-For: $proxy_add_x_forwarded_for
    X-Forwarded-Proto: $scheme
    X-Forwarded-Port: $server_port
    X-Forwarded-Host: $host
    Content-Type: $content_type

Using the UI

Go to Apps > New App > From Git and add to the following section:

Add custom nginx annotationsAdd custom nginx annotations

Add custom nginx annotations