Closed sebsel closed 7 years ago
Since we only support PHP 5.4+, we could just use PHP's http_response_code()
function. Unfortunately it won't work for the "don't set the header but return it" case.
Thanks to @fvsch it's now on the develop branch.
@sebsel, workaround for now (Kirby stable) would be to use PHP's header()
function directly:
header('HTTP/1.1 410 Gone');
(I think it's safe to assume your server is using HTTP 1.1. There can be edge cases with Web crawlers asking for HTTP 1.0 only, but it might not be a concern for your use case.)
Alternatively, from what I've read you can rely on some special behavior of this function and do:
header('_', true, 410);
The header string is invalid (but not empty, which is important here), but you're specifically asking for a 410 status code with the third parameter, so PHP sets a correct HTTP 410 status header. Working for me on PHP 5.6.
@fvsch Thanks! I actually just added the 410
in the array for my own site. You shouldn't edit toolkit files, but I hoped it would get fixed with an update, and it did! :)
I feel like I file all the bugs :( Trying to verify them before I post them, but this one I kinda need.
There is no
410 Gone
in https://github.com/getkirby/toolkit/blob/master/lib/header.php#L37Which I need per https://indieweb.org/deleted
Added it myself now, but I think it's a good addition. (Not to mention
418 I'm a teapot
🎉)