New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FastRoute falls back to GET on HEAD request #2386
Comments
Hmm, HEAD should be GET just w/o a response body. |
Do we correctly ditch the body when it's a HEAD? |
I'm not sure we do from a quick glance. We have the |
Todo:
|
Addressed in #2547 |
Re-opening - 3.x needs checking. |
I did some research for the 3.x code.
As the PSR-7 request is passed to the callable it is no problem to check manually if this is actually a $app->get('/', function (Request $request, Response $response, array $args) {
...
$isHeadMethod = $request->getMethod() === 'HEAD';
...
});
This is kind of tricky. The mentioned Lines 376 to 382 in 715d130
I think we need to integrate this at Lines 617 to 619 in 715d130
Here we need to check if this is not a |
We were trying to figure out why
HEAD
requests from bots were making their way into our controllers. Then we discovered that FastRoute falls back toGET
onHEAD
requests.This is unexpected.
Related, I've noticed a number of issues where Slim users are requesting an
$app->head(...)
shortcut be added to Slim, and the response is often to use$app->map(['HEAD'], ...)
instead. But given FastRoute's fallback you can just use$app->get(...)
to handleHEAD
requests. So my guess is this fallback behavior isn't well known in the Slim community.The text was updated successfully, but these errors were encountered: