From modules-dev-return-1661-apmail-httpd-modules-dev-archive=httpd.apache.org@httpd.apache.org Thu Apr 17 00:47:00 2008 Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@locus.apache.org Received: (qmail 46567 invoked from network); 17 Apr 2008 00:47:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Apr 2008 00:47:00 -0000 Received: (qmail 5710 invoked by uid 500); 17 Apr 2008 00:47:00 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 5678 invoked by uid 500); 17 Apr 2008 00:46:59 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 5669 invoked by uid 99); 17 Apr 2008 00:46:59 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Apr 2008 17:46:59 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [68.142.200.154] (HELO web30901.mail.mud.yahoo.com) (68.142.200.154) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 17 Apr 2008 00:46:08 +0000 Received: (qmail 60704 invoked by uid 60001); 17 Apr 2008 00:46:27 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=fKr8/13koRM3w8UNTxCtQLChsDoY7uRWzA5Bdd2CyCb7X3l5eRTtmBAWgj3nTMkmEMs/qdmed0s2A7QNLBIFVvpHhFgef1VQPNAoy9PO6ww7SnP8V93ndZh1EQP3tI4zxBQ1al/vk2dLZwsPQPImLsQxUtM/4MR/WB3nnLOmKBc=; X-YMail-OSG: 9.4LjrUVM1lc.B1rIwPKlNeJIIGRv8jNXPc.ENd7x9yX1PI.ZbRWD6gbou9ipguohRUaJQMEQoX5b0a_c1NRG8oK8o76kx4- Received: from [12.170.21.82] by web30901.mail.mud.yahoo.com via HTTP; Wed, 16 Apr 2008 17:46:27 PDT Date: Wed, 16 Apr 2008 17:46:27 -0700 (PDT) From: John Zhang Subject: perform a redirect in output filter To: modules-dev@httpd.apache.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <828803.60677.qm@web30901.mail.mud.yahoo.com> X-Virus-Checked: Checked by ClamAV on apache.org I am using apache 2.0/2.2, in my output filter, I would like to have the ability to redirect. Some tests indicated that I can redirect to a page on the same site, but not to an external site. Here is my code for redirect: char* location = apr_table_get(r->headers_out, "Location"); //Note this Location is set by my filter during the process, so I know I need to do a redirect. if(location && location[0]) { //r->status = 301; r->method = apr_pstrdup(r->pool, "GET"); r->method_number = M_GET; apr_table_unset(r->headers_in, "Content-Length"); ap_remove_output_filter(my_filter); ap_internal_redirect_handler(location, r); return APR_SUCCESS; } //tests: (if my site is http://localhost/foo) and when http://localhost/foo/bar.html (my test page)is loaded I want to redirect it to a) /foo/foo2/existing.html (works) b) http://localhost/foo/foo2/existing.html (works) c) http://www.google.com (does not work), instead I get http://localhost/foo displayed on the browser. Is there anything I did is incorrect? I noticed the method is called "*internal_redirect*", but did not know another one for "external redirect". Thanks, John