httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Manhaes Machado <andre.manh...@gmail.com>
Subject ErrorDocument's Behaviour
Date Tue, 18 May 2010 18:13:11 GMT
I searched in the list for someone with the same problem but I didn't find
out anything relates to my issue directly.

I set up a http server using a plugin from weblogic to server somes pages
with extension .jsp (further explanation about it take a look at
http://download.oracle.com/docs/cd/E12840_01/wls/docs103/plugins/apache.html
)

I tried to configure the ErrorDocument for not found pages (404). However,
the apache only shows the 404 page for documents which it respond itself I
mean the response from weblogic aren't analyzed by apache and the weblogic's
default 404 page are showed to the user.

Moreover, weblogic don't have a way to configure a custom, friendly errors
pages for all application. The only option is set up a 404 page in each
application.

Searching a way to bypass this issue, I took a look in the code in the
function ap_process_request(I'm using apache 2.2.11):

void ap_process_request(request_rec *r)
{
    int access_status;
    if (ap_extended_status)
        ap_time_process_request(r->connection->sbh, START_PREQUEST);
    access_status = ap_run_quick_handler(r, 0);
    if (access_status == DECLINED) {
        access_status = ap_process_request_internal(r);
        if (access_status == OK) {
            access_status = ap_invoke_handler(r);
        }
    }

    if (access_status == DONE) {
        /* e.g., something not in storage like TRACE */
        fclose(file);
        access_status = OK;
    }

    if (access_status == OK) {
        ap_finalize_request_protocol(r);
    }
    else {
        r->status = HTTP_OK;
        ap_die(access_status, r);
    }
...
...
}

I did some debug in it and I saw that the requests that are send to weblogic
come from with status access_status == OK when the page is not found. On the
other hand, when the page is reply by apache itself they have access_status
!=  OK and access_status != DONE ( the execution gets in "else" and it calls
the function ap_die) case the page doesn't exist. In this case, my custom
404 page is send to user as reply to its request.

I'm wondering what the reason for httpd wraps only errors which it do and
requests from other "entities" are just hand over to the user.

I believe it there should be a way to extend this behaviour to all requests
incomes in apache.

What do you think?

PS: the reply from weblogic when the page doesn't exist have the http status
code with value 404.

Mime
View raw message