Skip to content

Commit

Permalink
Bugfix: Uncache banner
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikdro committed Apr 20, 2020
1 parent 0028218 commit 28d0099
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
9 changes: 5 additions & 4 deletions Classes/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Neos\ContentRepository\Domain\Model\NodeInterface;
use Neos\ContentRepository\Domain\Service\ContextFactoryInterface;
use Neos\Eel\FlowQuery\FlowQuery;
use Neos\Flow\Http\Component\SetHeaderComponent;
use Neos\Flow\Mvc\Controller\RestController;
use Neos\Flow\Mvc\View\JsonView;
use Neos\Neos\View\FusionView;
Expand Down Expand Up @@ -38,11 +39,11 @@ class ApiController extends RestController
public function initializeAction()
{
parent::initializeAction();
$this->response->setHeader('Access-Control-Allow-Origin', $this->request->getHttpRequest()->getHeader('Origin'));
$this->response->setHeader('Access-Control-Allow-Headers', 'Content-Type, Cookie, credentials');
$this->response->setHeader('Access-Control-Allow-Credentials', 'true');
$this->response->setHeader('Vary', 'Origin');

//TODO: Make CORS configurable in settings
//$this->response->setComponentParameter(SetHeaderComponent::class, 'Access-Control-Allow-Origin', $this->request->getHttpRequest()->getHeader('Referer'));
//$this->response->setComponentParameter(SetHeaderComponent::class, 'Access-Control-Allow-Credentials', 'true');
$this->response->setComponentParameter(SetHeaderComponent::class, 'Vary', 'Origin');
}


Expand Down
11 changes: 1 addition & 10 deletions Resources/Private/Fusion/NodeTypes/Content.CookieSettings.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,14 @@ prototype(KaufmannDigital.GDPR.CookieConsent:Content.CookieSettings) < prototype
renderer = KaufmannDigital.GDPR.CookieConsent:Content.CookieSettings.Renderer

@cache {
mode = 'dynamic'
mode = 'uncached'

context {
1 = 'node'
2 = 'documentNode'
3 = 'site'
4 = 'cookieValue'
}
entryIdentifier {
node = ${node}
}
entryDiscriminator = ${(cookieValue) && (q(node).property('versionDate').timestamp >= Date.create(Json.parse(cookieValue).consentDate).timestamp)}
entryTags {
1 = ${Neos.Caching.descendantOfTag(node)}
2 = ${Neos.Caching.nodeTag(node)}
}

}

}
1 change: 0 additions & 1 deletion Resources/Private/Fusion/Root.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ prototype(Neos.Neos:Page) {

@position = 'before closingBodyTag'
}

}

cookieConsentSettings = KaufmannDigital.GDPR.CookieConsent:Content.CookieSettings

0 comments on commit 28d0099

Please sign in to comment.