diff --git a/.env.sample b/.env.sample index f5cc467..a754e46 100644 --- a/.env.sample +++ b/.env.sample @@ -25,4 +25,8 @@ HASHING_METHOD="sha256" ## This secret value is used to encrypt secret values (eg. ssh-keys, http-auth passwords, etc) ## You should consider your already stored secret values lost when changing this value. -COOKIE_LIFETIME=2592000 \ No newline at end of file +COOKIE_LIFETIME=2592000 + +## TRUSTED_PROXIES is a useful variable when using Docker and/or a reverse proxy. +## Set it to the IP address of your proxy. YOu can set to multiple proxies by comma-separating them +TRUSTED_PROXIES=127.0.0.1 \ No newline at end of file diff --git a/lib/Framework/Kernel.php b/lib/Framework/Kernel.php index cf8d359..8368a67 100644 --- a/lib/Framework/Kernel.php +++ b/lib/Framework/Kernel.php @@ -94,6 +94,7 @@ class Kernel private function parseRequest(): Request { + Request::setTrustedProxies(explode(',', $_ENV['TRUSTED_PROXIES']), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO); $request = Request::createFromGlobals(); return $request; }