Kubernetes and Authorization header stripped

Viewed 572

Project:

  • Deploy a staging API (Symfony) on a Kubernetes cluster on GCloud
  • With its services (MariaDB, RabbitMQ ...)

issue:

  1. All Pods and Services start correctly
  2. Access to the API from outside is problematic:
    • I deploy the API via a LoadBalancer service and the API is accessible but always removes the header "Authorization" which makes the API unusable.
    • I deploy the API via a Nginx-Ingress, the set of links to the correct air (the Ingress is well linked to the service and the pods of the API), I receive an external IP, but when I access this IP, the site is inaccessible (requests are lost and do not arrive at the servers).
1 Answers

If you are using Apache with CGI/FastCGI, then you might get an error message about missing authorization headers. This is because Apache does not, by default, pass authorization headers to PHP.

The Fix

You need to edit your Apache site configuration to add a line to your vhost config <VirtualHost> directive.

<VirtualHost>
    # ...
    SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
    # ...
</VirtualHost>
Related