httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sorin Manolache" <sor...@gmail.com>
Subject Re: internal redirect
Date Sat, 13 Dec 2008 18:04:17 GMT
On Sat, Dec 13, 2008 at 18:52, Sam Carleton <scarleton@miltonstreet.com> wrote:
> I thought I had seen a way to do an internal redirect in a module such
> that the browser would never be the wiser.  Is there?  If so, how do I
> do it?
>
> The reason is that I have coded myself into a hole.  I have a kiosk
> based system using Apache as the server and a custom application that
> wraps the IE7 WebControl as the client.  I have made changes to both
> client and server that checks the versions of both and makes sure they
> are in sync.  The in the module is done in the access checker hook.
> Right now I am using the standard HTML Location header to redirect to
> the error page.  The problem I have is that the client that is in the
> field sees that as an error and displays my almost useless error box
> to my customer, not a nice web page to inform them to upgrade the
> client.
>
> So the question is:  Within the access checker hook, how can I change
> the URL for this request so the browser sees a successful request but
> gets a different page?

I don't know which of them applies to your application, but here are a
couple of possible solutions:

1. Set the Location response header to your URL
(apr_table_set(r->headers_out, "Location", url)) and return
HTTP_MOVED_TEMPORARILY (i.e. 302) from access_checker. Or:
2. Return a non-OK and non-DECLINED value from access_checker and put
an ErrorDocument returned_code /url in your <Location>. Or:
3. Set a request note (apr_table_set(r->notes, "my_note",
"should_redirect")) and then in the handler hook you check the request
note. If it is set, ap_internal_redirect(your_url).

Hope this helps,
S

-- 
A: Because it reverses the logical flow of conversation.
Q: Why is top-posting frowned upon?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

Mime
View raw message