Skip to content

Commit

Permalink
Remove redirect headers from sales channel service
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasGraml11 committed Apr 25, 2024
1 parent a77ef20 commit ed5f32f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Export/Services/SalesChannelService.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ public function getRequest(Request $originalRequest, SalesChannelContext $salesC
$domain = $this->getSalesChannelDomain($salesChannelContext);

$parsedUrl = parse_url($domain->getUrl());
$host = $parsedUrl['host'] . (isset($parsedUrl['port']) ? ':' . $parsedUrl['port'] : '');

$serverVariables = array_merge($originalRequest->server->all(), [
'REQUEST_URI' => $parsedUrl['path'] ?? '/',
'SERVER_NAME' => $host,
'HTTP_HOST' => $host,
]);
unset($serverVariables['HTTP_FORWARDED']);
unset($serverVariables['HTTP_X_FORWARDED_FOR']);

// There is no Request::setUrl(), therefore we need to duplicate the current request object.
// @see https://github.com/symfony/symfony/issues/14575#issuecomment-102942494
Expand All @@ -75,10 +84,7 @@ public function getRequest(Request $originalRequest, SalesChannelContext $salesC
null,
null,
null,
array_merge($originalRequest->server->all(), [
'REQUEST_URI' => $parsedUrl['path'] ?? '/',
'HTTP_HOST' => $parsedUrl['host'] . (isset($parsedUrl['port']) ? ':' . $parsedUrl['port'] : ''),
])
$serverVariables,
);

return $this->requestTransformer->transform($request);
Expand Down

0 comments on commit ed5f32f

Please sign in to comment.