Skip to content

Commit

Permalink
FEATURE: Respect configured Neos.Flow.http.baseUri
Browse files Browse the repository at this point in the history
Related: #15
  • Loading branch information
bwaidelich committed Aug 14, 2019
1 parent 2bda941 commit 25da007
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Classes/Resource/Target/ProtectedResourceTarget.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ class ProtectedResourceTarget implements TargetInterface
*/
protected $httpRequest;

/**
* @Flow\InjectConfiguration(package="Neos.Flow", path="http.baseUri")
* @var string
*/
protected $defaultBaseUri;

/**
* @param string $name Name of this target instance, according to the resource settings
* @param array $options Options for this target
Expand Down Expand Up @@ -171,12 +177,11 @@ protected function shouldIncludeSecurityContext()
*/
protected function detectResourcesBaseUri()
{
$uri = '';
$request = $this->getHttpRequest();
if ($request instanceof HttpRequest) {
$uri = $request->getBaseUri();
if (!$request instanceof HttpRequest) {
return $this->defaultBaseUri;
}
return (string)$uri;
return (string)$request->getBaseUri();
}

/**
Expand Down

0 comments on commit 25da007

Please sign in to comment.