Configuration > NGINX Headers

For a variety of reasons you may want to configure nginx to set certain headers when using SevOne Data Insight. This can also be used to nullify large headers.

Create kubeobjects Directory

  1. Create kubeobjects directory.

    $ mkdir /opt/SevOne/kubeobjects
    

Create custom-headers.yaml

  1. Determine the headers you want to change and create a file, custom-headers.yaml file.

    Create /opt/SevOne/chartconfs/di_custom.yaml file

    $ touch /opt/SevOne/kubeobjects/custom-headers.yaml
    
  2. Add the following contents with your custom headers set under the data section.

    Create /opt/SevOne/kubeobjects/custom-headers.yaml file

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: custom-headers
      namespace: default
    data:
      X-Different-Name: "true"
      X-Request-Start: t=${msec}
      X-Using-Nginx-Controller: "true"  
    

Update Ingress Configuration

  1. Using a text editor of your choice, edit /opt/SevOne/chartconfs/ingress_custom.yaml file to set environment variable controller and then, save it.

    If /opt/SevOne/chartconfs/ingress_custom.yaml file does not exist, please create it.
    $ touch /opt/SevOne/chartconfs/ingress_custom.yaml`
    
    controller:
      config:
        proxy-set-headers: "default/custom-headers"
    

Update Ansible Inventory

  1. Using a text editor of your choice, edit /etc/ansible/group_vars/all/custom-headers.yaml file to set environment variable kube_object_ingress and then, save it.

    If /etc/ansible/group_vars/all/custom-headers.yaml file does not exist, please create it.
    $ touch /etc/ansible/group_vars/all/custom-headers.yaml`
    
    kube_object_ingress:
      enabled: true
      files:
      - /opt/SevOne/kubeobjects/custom-headers.yaml
    

Apply your Changes

$ sevone-cli cluster up

Force NGINX Config Reload

When checking the nginx config, you may find that the custom headers configmap and the configuration differ. This typically happens based on which files are loaded when bringing up SevOne Data Insight.

  1. To force the nginx config to reload, change the ingress controller config map.

    $ kubectl edit cm ingress-ingress-nginx-controller
    

    This will open the NGINX config file in text editor, vi. Find the data section and change variable keep-alive-requests.

    data:
      keep-alive-requests: "10001"
    
  2. To save and exit the file, enter :wq!

  3. Kubernetes will automatically regenerate NGINX's config.