Return-Path: X-Original-To: apmail-perl-modperl-archive@www.apache.org Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2662217786 for ; Tue, 6 Oct 2015 09:06:41 +0000 (UTC) Received: (qmail 80207 invoked by uid 500); 6 Oct 2015 09:06:40 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 80169 invoked by uid 500); 6 Oct 2015 09:06:40 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 80154 invoked by uid 99); 6 Oct 2015 09:06:40 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Oct 2015 09:06:40 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id D5472C0419 for ; Tue, 6 Oct 2015 09:06:39 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.9 X-Spam-Level: ** X-Spam-Status: No, score=2.9 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, WEIRD_PORT=0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 0paAuxrMD1ya for ; Tue, 6 Oct 2015 09:06:33 +0000 (UTC) Received: from mail-qg0-f48.google.com (mail-qg0-f48.google.com [209.85.192.48]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 2B061439E8 for ; Tue, 6 Oct 2015 09:06:33 +0000 (UTC) Received: by qgev79 with SMTP id v79so168585051qge.0 for ; Tue, 06 Oct 2015 02:06:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=5op/Uwt24ySNVRvrPurfLZHJQldtOjoxoLWAfwCGi5Y=; b=huyEPCawrt83hcWNdolk5f1CJc3O1KKG8foxxcPKbnWpwECCHyxoHn3C8GzcUhxpUr NbuBCWuDee/j67ePSGsBQd3maK6XTLclWGT/QxihECQm4+q57dfBiT2xd2GCEFgpXJML nPUGMbAdPSdVAIHVUDJC7/8/gHXWiDSYx2CYXBTdrgvnMtz90oI7vGIuCFMU25rO6Gq0 V9BHZHLUIYcTa0IEw663wQNhAikHhZ8Do12UxT0lru/oVJeAd2moF7YyhnG7yZiQLSPD 72Wf/mzV3DR+IxUobytIODMb1kAPxadfKnme/2V/7S6ey+PiHcj+rwhIpsROh0/cY5T5 KO4g== MIME-Version: 1.0 X-Received: by 10.140.32.247 with SMTP id h110mr45409272qgh.1.1444122392747; Tue, 06 Oct 2015 02:06:32 -0700 (PDT) Received: by 10.55.9.17 with HTTP; Tue, 6 Oct 2015 02:06:32 -0700 (PDT) Date: Tue, 6 Oct 2015 14:36:32 +0530 Message-ID: Subject: Unable to set custom header From: Ashish Mukherjee To: modperl@perl.apache.org Cc: sourabh.d.v@smartinsight.jp Content-Type: multipart/alternative; boundary=001a1139b5063b671005216bf2e1 --001a1139b5063b671005216bf2e1 Content-Type: text/plain; charset=UTF-8 Hello, I am trying to set a custom header through a mod_perl handler. My perl handler code is: sub handler { my $r = shift; $r->headers_out->add("foo" => "bar"); $r->log->error($r->connection->remote_ip()." is client IP"); return Apache2::Const::OK; } The handler gets called as I am able to see the log message, but the header is not emitted. My Apache configuration is - ProxyRequests On ProxyVia On ProxyRemote * http://localhost:3128 SetHandler modperl PerlPostReadRequestHandler +Foo::Proxy ProxyPass http://www.something.com/ ProxyPassReverse http://www.something.com/ When I do the same through mod_header like this it works - RequestHeader set foo bar I want foo: bar to go as a header in the HTTP request to my proxy on port 3128. Can anyone advise why my perl handler doesn't work when it should be doing the same thing as mod_headers? Regards, Ashish --001a1139b5063b671005216bf2e1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hello,

I am trying to set a custom head= er through a mod_perl handler.=C2=A0

My perl handl= er code is:

sub handler {
=C2= =A0 =C2=A0 my $r =3D shift;

=C2=A0 =C2=A0 $r->h= eaders_out->add("foo" =3D> "bar");
=C2= =A0 =C2=A0 $r->log->error($r->connection->remote_ip()." is= client IP");

=C2=A0 =C2=A0 return= Apache2::Const::OK;
}

The handler= gets called as I am able to see the log message, but the header is not emi= tted.

My Apache configuration is -

<= /div>
=C2=A0 ProxyRequests On
=C2=A0 ProxyVia On
=C2=A0 ProxyRemote * http://localhost:= 3128

=C2=A0 SetHandler modperl
=C2=A0 PerlPostReadRequestHandler +Foo::Proxy
=C2=A0 = =C2=A0 =C2=A0 =C2=A0
=C2=A0 <Location />
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ProxyPass http://www.something.com/
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 ProxyPassReverse http:= //www.something.com/
=C2=A0 =C2=A0</Location>
=

When I do the same through mod_header like this i= t works -

RequestHeader set foo bar

I want foo: bar to go as a header in the HTTP request= to my proxy on port 3128.=C2=A0

Can anyone advise= why my perl handler doesn't work when it should be doing the same thin= g as mod_headers?

Regards,
Ashish
<= /div> --001a1139b5063b671005216bf2e1--