Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
9fb76eaf
Commit
9fb76eaf
authored
9 years ago
by
catch
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2609076
by alexpott, Darren Oh: Install failure with HTTPS reverse proxy on newer browsers
parent
dc736e72
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/includes/install.core.inc
+3
-0
3 additions, 0 deletions
core/includes/install.core.inc
core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php
+21
-8
21 additions, 8 deletions
...ib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php
with
24 additions
and
8 deletions
core/includes/install.core.inc
+
3
−
0
View file @
9fb76eaf
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
use
Drupal\Core\Logger\LoggerChannelFactory
;
use
Drupal\Core\Logger\LoggerChannelFactory
;
use
Drupal\Core\Site\Settings
;
use
Drupal\Core\Site\Settings
;
use
Drupal\Core\StringTranslation\Translator\FileTranslation
;
use
Drupal\Core\StringTranslation\Translator\FileTranslation
;
use
Drupal\Core\StackMiddleware\ReverseProxyMiddleware
;
use
Drupal\Core\Extension\ExtensionDiscovery
;
use
Drupal\Core\Extension\ExtensionDiscovery
;
use
Drupal\Core\DependencyInjection\ContainerBuilder
;
use
Drupal\Core\DependencyInjection\ContainerBuilder
;
use
Drupal\Core\Url
;
use
Drupal\Core\Url
;
...
@@ -403,6 +404,8 @@ function install_begin_request($class_loader, &$install_state) {
...
@@ -403,6 +404,8 @@ function install_begin_request($class_loader, &$install_state) {
$kernel
->
setSitePath
(
$site_path
);
$kernel
->
setSitePath
(
$site_path
);
$kernel
->
boot
();
$kernel
->
boot
();
$container
=
$kernel
->
getContainer
();
$container
=
$kernel
->
getContainer
();
// If Drupal is being installed behind a proxy, configure the request.
ReverseProxyMiddleware
::
setSettingsOnRequest
(
$request
,
Settings
::
getInstance
());
// Register the file translation service.
// Register the file translation service.
if
(
isset
(
$GLOBALS
[
'config'
][
'locale.settings'
][
'translation'
][
'path'
]))
{
if
(
isset
(
$GLOBALS
[
'config'
][
'locale.settings'
][
'translation'
][
'path'
]))
{
...
...
This diff is collapsed.
Click to expand it.
core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php
+
21
−
8
View file @
9fb76eaf
...
@@ -47,28 +47,41 @@ public function __construct(HttpKernelInterface $http_kernel, Settings $settings
...
@@ -47,28 +47,41 @@ public function __construct(HttpKernelInterface $http_kernel, Settings $settings
*/
*/
public
function
handle
(
Request
$request
,
$type
=
self
::
MASTER_REQUEST
,
$catch
=
TRUE
)
{
public
function
handle
(
Request
$request
,
$type
=
self
::
MASTER_REQUEST
,
$catch
=
TRUE
)
{
// Initialize proxy settings.
// Initialize proxy settings.
if
(
$this
->
settings
->
get
(
'reverse_proxy'
,
FALSE
))
{
static
::
setSettingsOnRequest
(
$request
,
$this
->
settings
);
$ip_header
=
$this
->
settings
->
get
(
'reverse_proxy_header'
,
'X_FORWARDED_FOR'
);
return
$this
->
httpKernel
->
handle
(
$request
,
$type
,
$catch
);
}
/**
* Sets reverse proxy settings on Request object.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* A Request instance.
* @param \Drupal\Core\Site\Settings $settings
* The site settings.
*/
public
static
function
setSettingsOnRequest
(
Request
$request
,
Settings
$settings
)
{
// Initialize proxy settings.
if
(
$settings
->
get
(
'reverse_proxy'
,
FALSE
))
{
$ip_header
=
$settings
->
get
(
'reverse_proxy_header'
,
'X_FORWARDED_FOR'
);
$request
::
setTrustedHeaderName
(
$request
::
HEADER_CLIENT_IP
,
$ip_header
);
$request
::
setTrustedHeaderName
(
$request
::
HEADER_CLIENT_IP
,
$ip_header
);
$proto_header
=
$
this
->
settings
->
get
(
'reverse_proxy_proto_header'
,
'X_FORWARDED_PROTO'
);
$proto_header
=
$settings
->
get
(
'reverse_proxy_proto_header'
,
'X_FORWARDED_PROTO'
);
$request
::
setTrustedHeaderName
(
$request
::
HEADER_CLIENT_PROTO
,
$proto_header
);
$request
::
setTrustedHeaderName
(
$request
::
HEADER_CLIENT_PROTO
,
$proto_header
);
$host_header
=
$
this
->
settings
->
get
(
'reverse_proxy_host_header'
,
'X_FORWARDED_HOST'
);
$host_header
=
$settings
->
get
(
'reverse_proxy_host_header'
,
'X_FORWARDED_HOST'
);
$request
::
setTrustedHeaderName
(
$request
::
HEADER_CLIENT_HOST
,
$host_header
);
$request
::
setTrustedHeaderName
(
$request
::
HEADER_CLIENT_HOST
,
$host_header
);
$port_header
=
$
this
->
settings
->
get
(
'reverse_proxy_port_header'
,
'X_FORWARDED_PORT'
);
$port_header
=
$settings
->
get
(
'reverse_proxy_port_header'
,
'X_FORWARDED_PORT'
);
$request
::
setTrustedHeaderName
(
$request
::
HEADER_CLIENT_PORT
,
$port_header
);
$request
::
setTrustedHeaderName
(
$request
::
HEADER_CLIENT_PORT
,
$port_header
);
$forwarded_header
=
$
this
->
settings
->
get
(
'reverse_proxy_forwarded_header'
,
'FORWARDED'
);
$forwarded_header
=
$settings
->
get
(
'reverse_proxy_forwarded_header'
,
'FORWARDED'
);
$request
::
setTrustedHeaderName
(
$request
::
HEADER_FORWARDED
,
$forwarded_header
);
$request
::
setTrustedHeaderName
(
$request
::
HEADER_FORWARDED
,
$forwarded_header
);
$proxies
=
$
this
->
settings
->
get
(
'reverse_proxy_addresses'
,
array
());
$proxies
=
$settings
->
get
(
'reverse_proxy_addresses'
,
array
());
if
(
count
(
$proxies
)
>
0
)
{
if
(
count
(
$proxies
)
>
0
)
{
$request
::
setTrustedProxies
(
$proxies
);
$request
::
setTrustedProxies
(
$proxies
);
}
}
}
}
return
$this
->
httpKernel
->
handle
(
$request
,
$type
,
$catch
);
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment