merged branch fabpot/referer-in-404 (PR #8708)
This PR was merged into the master branch. Discussion ---------- Add the referer information that could help you findout where's the link comes from | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a #8218 rebased on master and slightly tweaked. Commits -------8eb163d
[HttpKernel] tweaked previous commitbb5954e
Add the referer information that could help you findout where's the link comes from.
This commit is contained in:
commit
43e066f7ab
@ -113,6 +113,10 @@ class RouterListener implements EventSubscriberInterface
|
||||
} catch (ResourceNotFoundException $e) {
|
||||
$message = sprintf('No route found for "%s %s"', $request->getMethod(), $request->getPathInfo());
|
||||
|
||||
if ($referer = $request->headers->get('referer')) {
|
||||
$message .= sprintf(' (from "%s")', $referer);
|
||||
}
|
||||
|
||||
throw new NotFoundHttpException($message, $e);
|
||||
} catch (MethodNotAllowedException $e) {
|
||||
$message = sprintf('No route found for "%s %s": Method Not Allowed (Allow: %s)', $request->getMethod(), $request->getPathInfo(), strtoupper(implode(', ', $e->getAllowedMethods())));
|
||||
|
Reference in New Issue
Block a user