Skip to content

Commit

Permalink
Merge pull request #4490 from pKallert/feature/addHttpStatusToShortcut
Browse files Browse the repository at this point in the history
FEATURE: Add HTTP Status Code to Shortcuts
  • Loading branch information
kitsunet authored Dec 29, 2023
2 parents 63370e8 + 2d878e0 commit 63725aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Neos.Neos/Classes/Controller/Frontend/NodeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ class NodeController extends ActionController
#[Flow\Inject]
protected RenderingModeService $renderingModeService;

#[Flow\InjectConfiguration(path: "frontend.shortcutRedirectHttpStatusCode", package: "Neos.Neos")]
protected int $shortcutRedirectHttpStatusCode;

/**
* @param string $node Legacy name for backwards compatibility of route components
* @throws NodeNotFoundException
Expand Down Expand Up @@ -299,7 +302,8 @@ protected function handleShortcutNode(NodeAddress $nodeAddress, ContentRepositor
} else {
$resolvedUri = $resolvedTarget;
}
$this->redirectToUri($resolvedUri);

$this->redirectToUri($resolvedUri, statusCode: $this->shortcutRedirectHttpStatusCode);
}

private function fillCacheWithContentNodes(
Expand Down
4 changes: 4 additions & 0 deletions Neos.Neos/Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ Neos:
label: 'Neos.Neos:Main:nodeTypes.groups.plugins'
collapsed: true

frontend:
# HTTP Status Code used for redirecting Neos.Neos:Shortcut to target
shortcutRedirectHttpStatusCode: 303

userInterface:

# Switch on to see all translated labels getting scrambled. You now can localize
Expand Down

0 comments on commit 63725aa

Please sign in to comment.