How to extract the protocol part of URL from an apache request - modperl

This is a discussion on How to extract the protocol part of URL from an apache request - modperl ; Hi, I am using mod_perl for authentication. I could able to extract the Host and path information of the currect URL using apache request object. like $apache->header_in(Host) and $apache->uri respectively. But , i couldn't find how to extract the protocol(http ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: How to extract the protocol part of URL from an apache request

  1. How to extract the protocol part of URL from an apache request


    Hi,

    I am using mod_perl for authentication.

    I could able to extract the Host and path information of the currect URL
    using apache request object.
    like $apache->header_in(Host) and $apache->uri respectively.

    But , i couldn't find how to extract the protocol(http or https ) from the
    current URL using apache request object.

    Can you please anybody help me in this?

    Thanks,
    Raja
    --
    View this message in context: http://www.nabble.com/How-to-extract...p19526642.html
    Sent from the mod_perl - General mailing list archive at Nabble.com.


  2. Re: How to extract the protocol part of URL from an apache request

    On Wed, 17 Sep 2008 00:21:52 -0700 (PDT)
    grsvarma019 wrote:

    > But , i couldn't find how to extract the protocol(http or https )
    > from the current URL using apache request object.
    > Can you please anybody help me in this?


    See: perldoc Apache2::RequestRec

    # HTTP protocol version number
    $proto_num = $r->proto_num();


  3. Re: How to extract the protocol part of URL from an apache request

    On Wed 17 Sep 2008, grsvarma019 wrote:
    > But , i couldn't find how to extract the protocol(http or https )


    There are Apache2::ModSSL and Apache::SSLLookup on CPAN in case you need
    that information in a request phase prior to the ResponseHandler.
    Mod_ssl can be configured to export SSL information as environment
    variables. Those can be looked up in a ResponseHandler via
    $r->subprocess_env.

    Further, if you are unable to install an XS module (precompiled
    mod_perl+apache on windows without C compiler for instance) and you
    need SSL information prior to the response phase you can issue a
    subrequest to get it. Not the fastest way but it works. I have
    described that technique in a previous mail to the list this or last
    year.

    Torsten

    --
    Need professional mod_perl support?
    Just hire me: torsten.foertsch@gmx.net


  4. Re: How to extract the protocol part of URL from an apache request

    On Wed 17 Sep 2008, John ORourke wrote:
    > I had the same problem but the machine serving the request had a
    > reverse proxy in front of it. *I used the following to inject a
    > header on the proxy:
    >
    > * * * * SetEnv SCHEME http
    > * * * * RewriteCond %{HTTPS} on
    > * * * * RewriteRule ^(.*) $1 [E=SCHEME:https]


    Yes, I think that should work as well without the reverse proxy.
    Mod_rewrite talks directly to mod_ssl.

    Torsten

    --
    Need professional mod_perl support?
    Just hire me: torsten.foertsch@gmx.net


+ Reply to Thread