Skip to content

Commit 2433f4d

Browse files
committed
Merge branch '4.x' into 4.next
2 parents 5c452d8 + 630f148 commit 2433f4d

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

config/.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
# environment.
66
#
77
# Having this file in production is considered a **SECURITY RISK** and also decreases
8-
# the boostrap performance of your application.
8+
# the bootstrap performance of your application.
99
#
1010
# To use this file, first copy it into `config/.env`. Also ensure the related
11-
# code block for loading this file is uncommented in `config/boostrap.php`
11+
# code block for loading this file is uncommented in `config/bootstrap.php`
1212
#
1313
# In development .env files are parsed by PHP
1414
# and set into the environment. This provides a simpler

config/bootstrap.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,18 @@
138138
*/
139139
$fullBaseUrl = Configure::read('App.fullBaseUrl');
140140
if (!$fullBaseUrl) {
141+
/*
142+
* When using proxies or load balancers, SSL/TLS connections might
143+
* get terminated before reaching the server. If you trust the proxy,
144+
* you can enable `$trustProxy` to rely on the `X-Forwarded-Proto`
145+
* header to determine whether to generate URLs using `https`.
146+
*
147+
* See also https://book.cakephp.org/4/en/controllers/request-response.html#trusting-proxy-headers
148+
*/
149+
$trustProxy = false;
150+
141151
$s = null;
142-
if (env('HTTPS')) {
152+
if (env('HTTPS') || ($trustProxy && env('HTTP_X_FORWARDED_PROTO') === 'https')) {
143153
$s = 's';
144154
}
145155

0 commit comments

Comments
 (0)