WebFaction
Community site: login faq
0
1

I'm running a Django app with mod_wsgi 3.4, and I've noticed that some of my internal server error pages show "200 error" in the title bar. A 200 response usually means that there's no problem, so what's up with that?

asked 01 Oct '12, 18:21

seanf
12.2k42136
accept rate: 37%

edited 03 Oct '12, 10:22


A "200 error" from a mod_wsgi app is really an internal server error.

mod_wsgi 3.4 introduced some new code that returns a "200 Error" status line:

/*
 * Look for the special case of status being 200 but the
 * status line indicating an error and translate it into a
 * 500 error so that error document processing will occur
 * for those cases where WSGI application wouldn't have
 * supplied their own error document. We used to use 0
 * here for status but Apache 2.4 prohibits it now.
 */

.....

/*
 * Execute the actual target WSGI application. In
 * normal cases OK should always be returned. If
 * however an error occurs in importing or executing
 * the script or the Python code raises an exception
 * which is not caught and handled, then an internal
 * server error can be returned. As we don't want to
 * be triggering any error document handlers in the
 * daemon process we use a fake status line with 0
 * as the status value. This will be picked up in
 * the Apache child process which will translate it
 * back to a 500 error so that normal error document
 * processing occurs.
 */

r->status = HTTP_OK;

if (wsgi_execute_script(r) != OK) {
    r->status = HTTP_INTERNAL_SERVER_ERROR;
    r->status_line = "200 Error";
}

Apache interprets it as a 500 error, and you'll see the 500 result code in your logs, but the generated title of the Apache error page will show the "200 Error" status line.

permanent link

answered 01 Oct '12, 18:27

seanf
12.2k42136
accept rate: 37%

edited 02 Oct '12, 10:11

I think the essence of the question is "how do I fix this?" rather than "how does the 200 error page show up?" I'm having this same problem and have absolutely nothing to go on.

(03 Oct '12, 10:11) vegan

No, the essence of my question is "why am I seeing an error message that has a 200 response code in the title, when 200 usually means that everything is OK?" :)

As I mentioned in the answer, the "200 error" is actually an internal server error, and I've included a link to the relevant documentation that should help you resolve the error.

(03 Oct '12, 10:17) seanf

Did you ever find a solution to this problem?

(13 Nov '13, 18:05) noslan

Yes, see above.

(13 Nov '13, 18:08) seanf

So this means, it's hitting my app (wsgi.py), but there's something wrong in the app, that's causing it to fail?

(08 Dec '13, 11:02) monkut

Yes, turn on debugging or check your logs to find the cause.

(08 Dec '13, 11:08) timg ♦♦

I think there is something wrong with my httpd.conf, I'm not getting any of mod_wsgi's error output in my error_<app>.log

(10 Dec '13, 07:33) monkut

log locations were different, doh! user & apache

(10 Dec '13, 07:37) monkut
showing 5 of 8 show 3 more comments
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×108
×56
×2
×1

question asked: 01 Oct '12, 18:21

question was seen: 8,602 times

last updated: 10 Dec '13, 07:37

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM