Skip to content
Discussion options

You must be logged in to vote

Yes. FrankenPHP's env accepts placeholders; this image already uses env REMOTE_ADDR {client_ip} in its php_server block. So you can set HTTPS from a variable that is only filled in when it's safe. I tested this with serversideup/php:8.4-frankenphp (FrankenPHP 1.13.4, Caddy 2.11.7).

  1. Add /etc/frankenphp/caddyfile-server.d/https-from-proxy.caddyfile. That directory is imported into your site block:
    # HTTPS=on when the request itself is TLS, or when a trusted proxy says it was
    @https_request {
    	protocol https
    }
    @forwarded_https {
    	remote_ip private_ranges
    	header X-Forwarded-Proto https
    }
    vars @https_request is_https on
    vars @forwarded_https is_https on
  2. Pass it into PHP:
    CADDY_PHP_SERVER_OP…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kohenkatz
Comment options

Answer selected by kohenkatz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants