PHP SERVER SSL_CLIENT_CERT disappears for when navigating pages
I am containerizing a legacy webservice that use SSL Client certificate validation. I have an apache 2.4 container and a PHP 7.4 FPM container.
My apache virtual host conf looks like
...
<VirtualHost *:8443>
DocumentRoot /var/www/html/myapp
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://php:9000/var/www/html/myapp/$1
SSLEngine on
....
SSLCACertificateFile <PATH TO CA>
SSLVerifyClient optional
SSLVerifyDepth 2
...
<Files ~ "\.(cgi|shtml||phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>
<Directory "/var/www/html/myapp">
SSLOptions +StdEnvVars +ExportCertData
Require all granted
DirectoryIndex index.php
</Directory>
...
</VirtualHost>
....
index.php
<?
print_r($_SERVER);
?>
<html>
....
<a href=go.php><img name=go src=="go.png" alt="GO!"></a>
....
</html>
Go.php
<?php
print_r($_SERVER);
... DO Authoriztion stuff with SSL_CLIENT_CERT ...
?>
docker-compose.yml
version: 3.4"
services:
apache:\
image: myappApache
depends_on: php
networks:
- frontend
- backend
ports:
- "80:8080"
- "443:8443"
volumes:
- ./myapp/:/var/www/html/myapp:rw
php:
image: myappPHP
networks:
- backend
volumes:
- ./myapp/:/var/www/html/myapp:to
networks:
frontend:
backend:
When I navigate to my index.php and print out the value of _SERVER
with print_r($_SERVER)
I can see [SSL_CLIENT_CERT] => -----BEGIN CERTIFICARTE----- ... -----END CERTIFICATE-----
. However when I click on the link that on that page which takes me to a second page on the website the SSL_CLIENT_CERT
is missing from _SERVER
. Other SSL Related items are missing as well
- SSL_SESSION_RESUMED
- SSL_SESSION_ID
- SSL_SERVER_A_SIG
- SSL_SERVER_A_KEY
- SSL_SERVER_I_DN
How do I keep _SERVER
configuration settings from disappearing between pages?
Solution 1:
Not sure why this worked. But I moved the SSLOptions +StdEvnVars +ExportCertData
outside of the Directory
group and that seemed to fix things.