PHP (Apache) silently converting HTTP 429 and others to 500

前端 未结 2 402
北荒
北荒 2020-12-31 12:18

I just discovered an oddity in PHP\'s header() method silently converting some of my statuses to 500. Since I had no luck in finding mention of this behavior in various web

2条回答
  •  太阳男子
    2020-12-31 12:44

    It's Apache, 99% sure, I can't find it direcly in it's docs, but I can infer it from the test below (Apache version 2.2.22)

    Add this in your config:

    ErrorDocument 429 Aaargh to heavy
    

    Restart:

    $ sudo /etc/init.d/apache2 restart
    Syntax error on line 6 of /etc/apache2/conf.d/localized-error-pages:
    Unsupported HTTP response code 429
    Action 'configtest' failed.
    The Apache error log may have more information.
       ...fail!
    

    429 also seems a recent addition in rfc6585, status: proposed, date: April 2012. One year old for HTTP RFCs is... just a baby in my experience. Add to that the process of getting it in Apache, and then in your package repositories... Well, you could try Apache 2.4...

提交回复
热议问题