HEAD-Anfragen wie GET beantworten (curl -I lieferte 405)
Der Front Controller akzeptierte nur GET und POST, daher antworteten HEAD-Anfragen (curl -I, Monitoring, Preload-Checks) auf allen Routen mit 405. HEAD wird jetzt als GET behandelt, der Rumpf wird verworfen.
This commit is contained in:
parent
dd1fba062e
commit
cf1849a9ce
1 changed files with 11 additions and 0 deletions
|
|
@ -17,4 +17,15 @@ if ($basePath !== '' && str_starts_with($uriPath, $basePath)) {
|
|||
$path = '/' . trim($uriPath, '/');
|
||||
$method = request_method();
|
||||
|
||||
// HEAD (z. B. curl -I) muss wie GET beantwortet werden, nur ohne Rumpf.
|
||||
if ($method === 'HEAD') {
|
||||
$method = 'GET';
|
||||
ob_start();
|
||||
register_shutdown_function(static function (): void {
|
||||
while (ob_get_level() > 0) {
|
||||
ob_end_clean();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
page_handle($method, $path);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue