Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

how can i modify the http status when bonk happens?

eleitheleith New
edited May 2010 in Vanilla 2.0 - 2.8
the 'bonk' error page is pushed out with http status 200 (which means OK)

i've got a plugin that allows me to grab JSON data from my forums, and so when i hit an error, i get the body of the BONK page. if the http status were something different however, i could appropriately capture this event by looking at the status code (rather than in a try/for loop waiting for a bad json parsing error to occur)

an http status of 500 seems appropriate for BONK.

does someone got a quick clue of where i can look to do this? else, i'll just grep around...


  • Options
    I would say it's better to make this a bug report, as this is really something which should be there already.
  • Options
    good idea.

    i'ld still like to know where to look, because i could just drop 1-2 lines in and solve this without waiting for the bug to be accepted, fixed and pushed upstream.
  • Options
    to output http status 404, in applications/garden/controllers/home.php add
    header('Content-Type: text/html; charset=utf-8', true, 404);
    into function FileNotFound, just before Render()


    to output http status 500, in library/core/functions.error.php add
    header('Content-Type: text/html; charset=utf-8', true, 500);
    after ob_end_clean
  • Options
    @eleith, Fork, push the changes online and send vanillaforums a pull request.
  • Options
    sounds good.

    though i don't have a github account, nor do i use git to do anything more than checkout and pull. (i do use hg/svn though).

    unless you were willing to document the entire process you proposed, that will have to wait till i find the time to play with git and github.

    if you did document it (might be a great resource to have on vanilla documentation), i'd do it asap, and probably would try and push through other changes i've made.

Sign In or Register to comment.