I have an apache configuration with reverse proxy (IP of this server: 192.168.1.82
) to handle my new D9 server:
192.168.1.82 : 443 is passed to 192.168.1.87 as HTTP(80)
<VirtualHost *:443>
ServerName www.mydomain.be
ServerAlias mydomain.be
NameVirtualHost www.mydomain.be
ProxyPreserveHost On
ProxyPass / http://192.168.1.87:80/
ProxyPassReverse / http://192.168.1.87/
SSLProxyCheckPeerCN Off
SSLProxyCheckPeerName Off
SSLProxyVerify none
...
</VirtualHost>
I think it is called SSL Termination
192.168.1.82 : 80 is redirected as https (443)
<VirtualHost *:80>
ServerName www.mydomain.be
Redirect permanent / https://www.mydomain.be/
</VirtualHost>
192.168.1.87 : settings.php
$settings['reverse_proxy'] = TRUE;
$settings['reverse_proxy_addresses'] = [
'192.168.1.82',
];
$_SERVER['HTTPS'] = 'on';
$settings['ssl'] = TRUE;
Unfortunately the autocomplete feature of an entity reference field request a non https (unsecure) endpoint (Mixed content):
http://www.mydomain.be/fr/entity_reference_autocomplete/node/default:node/3veI...I?q=t
What can I do to force the https... I will accept the most ugly hack if it is working (yes, I am here)
Test 1: ProxyPass https instead of http [will not work, see below]
I have adapted the 82 virtual host as follow;
SSLProxyEngine on
ProxyPass / https://192.168.1.87/
ProxyPassReverse / https://192.168.1.87/
=>This time I don't have the mixed content problem, but I have ERR_TOO_MANY_REDIRECTS
again for this entity autocomplete endpoint
Test 2: hack Symfony\Component\HttpFoundation\Request::isSecure()
Here is my new isSecure() function:
public function isSecure(){
return TRUE;
}
By doing this, the autocomplete url use https, but this time, I got ERR_TOO_MANY_REDIRECTS
GET https://www.mydomain.be/fr/entity_reference_autocomplete/node/default%3Anode/3ve...I?q=T net::ERR_TOO_MANY_REDIRECTS
I have really no clue from where it can come