File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 138138 */
139139$ fullBaseUrl = Configure::read ('App.fullBaseUrl ' );
140140if (!$ 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
You can’t perform that action at this time.
0 commit comments