Repository navigation
|
The default trusted proxy configuration uses the However, this configuration does not handle the other This means that frameworks such as Laravel and Symfony cannot detect whether the request came from HTTPS or not. (Without Here is what Symfony's /**
* Checks whether the request is secure or not.
*
* This method can read the client protocol from the "X-Forwarded-Proto" header
* when trusted proxies were set via "setTrustedProxies()".
*
* The "X-Forwarded-Proto" header must contain the protocol: "https" or "http".
*/
public function isSecure(): bool
{
if ($this->isFromTrustedProxy() && $proto = $this->getTrustedValues(self::HEADER_X_FORWARDED_PROTO)) {
return \in_array(strtolower($proto[0]), ['https', 'on', 'ssl', '1'], true);
}
$https = $this->server->get('HTTPS');
return $https && (!\is_string($https) || 'off' !== strtolower($https));
}Is there any way to configure FrankenPHP to set I know that it's technically possible to work around this (as noted in the documentation) by setting Laravel's trusted proxies to |
Replies: 1 comment 1 reply
|
Yes. FrankenPHP's
Results with
Notes:
|
Yes. FrankenPHP's
envaccepts placeholders; this image already usesenv REMOTE_ADDR {client_ip}in itsphp_serverblock. So you can setHTTPSfrom a variable that is only filled in when it's safe. I tested this withserversideup/php:8.4-frankenphp(FrankenPHP 1.13.4, Caddy 2.11.7)./etc/frankenphp/caddyfile-server.d/https-from-proxy.caddyfile. That directory is imported into your site block: