You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Scott Alexander <mo...@humak.edu> on 2003/02/20 12:40:24 UTC

Apache::TicketAccess

Hi,

I'm trying to use the example from the Eagle book on page 309 - 314 using
the TicketAccess, TicketMaster, TicketTool handlers.

In TicketMaster in sub go_to_uri it sets the a cookie with the $ticket.

I can print $ticket to error log to see what it contains. But for some
reason the cookie never gets set.

Netscape's cookie manager doesn't show any new cookie from my site.


Here is a copy from my httpd.cong file for the two servers.

david1 is a mod_proxy for the mod_perl server (david)

On david1 I have
ProxyPass /login.pl http://david:8080/login.pl
ProxyPassReverse /login.pl http://david:8080/


On david the mod_perl server in the httpd.conf file I have
============================

<Location /login.pl>
        SetHandler  perl-script
        PerlHandler Apache::TicketMaster
        PerlSetVar  TicketDomain   david1
        PerlSetVar  TicketSecret   /key.txt
        PerlSetVar  TicketDatabase mysql:admin
        PerlSetVar  TicketTable    person:user:passwd
        PerlSetVar  TicketExpires  100
</Location>



<Directory /usr/local/systems/work/>
        PerlSendHeader On
        SetHandler perl-script
        PerlHandler Apache::Registry
        Options +ExecCGI

        # OLD
        #AuthName "Oppilaitosjärjestelmä"
        #AuthType Basic
        #PerlAuthenHandler Apache::AuthAny
        #require valid-user
        #<Limit GET POST PUT DELETE>
        #        require valid-user
        #</Limit>

        # NEW
        PerlAccessHandler Apache::TicketAccess
        PerlSetVar TicketDomain david1
        PerlSetVar TicketSecret   /key.txt
        PerlSetVar  TicketDatabase mysql:admin
        PerlSetVar  TicketTable    person:user:passwd
        PerlSetVar  TicketExpires  100
        ErrorDocument 403 /login.pl

        ErrorDocument 401 /bin/admin/error/401.html
        #ErrorDocument 403 /bin/admin/error/403.html
        ErrorDocument 404 /bin/admin/error/404.html
        ErrorDocument 500 /bin/admin/error/500.html
</Directory>

Any help is appreciated

Scott


Re: Apache::TicketAccess

Posted by Perrin Harkins <pe...@elem.com>.
Scott Alexander wrote:
> I'm trying to use the example from the Eagle book on page 309 - 314 using
> the TicketAccess, TicketMaster, TicketTool handlers.
> 
> In TicketMaster in sub go_to_uri it sets the a cookie with the $ticket.
> 
> I can print $ticket to error log to see what it contains. But for some
> reason the cookie never gets set.

I haven't used these modules, but I suggest you do some further 
debugging.  Try looking at the headers being sent back from the server 
and see if it is sending the cookie header or not.  Try going straight 
to it without going through the proxy.  Find out what is actually 
happening.  Then you'll have a better idea what needs to be fixed.

By the way, most people use CPAN modules for this rather than the stuff 
in the Eagle book.  Look at things like Apache::AuthTicket or 
Apache::AuthCookieURL.  (I don't have a use for any of these modules, so 
I can't personally recommend one.)

- Perrin



Re: Apache::TicketAccess

Posted by Ask Bjoern Hansen <as...@develooper.com>.
On Thu, 20 Feb 2003, Nick Tonkin wrote:

> > Is it the cookie doesn't get sent back thru the reverse proxy?
>
> As Perrin said, you need to see what is actually happening. Dumping the
> headers is a great way to start. Right at the top of your handler do

Or you can use Apache::DumpHeaders.

http://search.cpan.org/dist/Apache-DumpHeaders/DumpHeaders.pm


 - ask

-- 
ask bjoern hansen, http://www.askbjoernhansen.com/ !try; do();

Re: Apache::TicketAccess

Posted by Nick Tonkin <ni...@tonkinresolutions.com>.
On Thu, 20 Feb 2003, Scott Alexander wrote:

> On Thu, 20 Feb 2003, Scott Alexander wrote:
>
> If I set my browser to david:8080/login.pl then everything works okay,
> Cookie gets set, and my session is current until I logout.
>
> So the setup is something to do with mod_proxy on the proxy server.
>
> Is it the cookie doesn't get sent back thru the reverse proxy?

As Perrin said, you need to see what is actually happening. Dumping the
headers is a great way to start. Right at the top of your handler do

sub handler {
    my $r = shift;
    warn $r->as_string;


If the cookies are being sent to the browser, they'll be there. If they
are and it's still not working, you need to look at the reading of the
cookies in your module.

- nick

-- 

~~~~~~~~~~~~~~~~~~~~
Nick Tonkin   {|8^)>


Re: Apache::TicketAccess

Posted by Scott Alexander <mo...@humak.edu>.
On Thu, 20 Feb 2003, Scott Alexander wrote:

If I set my browser to david:8080/login.pl then everything works okay,
Cookie gets set, and my session is current until I logout.

So the setup is something to do with mod_proxy on the proxy server.

Is it the cookie doesn't get sent back thru the reverse proxy?

I use cookies in some other areas of the application and they are working
fine since moving over to a reverse_proxy server, mod_perl server setup.

Regards

Scott


> Hi,
>
> I'm trying to use the example from the Eagle book on page 309 - 314 using
> the TicketAccess, TicketMaster, TicketTool handlers.
>
> In TicketMaster in sub go_to_uri it sets the a cookie with the $ticket.
>
> I can print $ticket to error log to see what it contains. But for some
> reason the cookie never gets set.
>
> Netscape's cookie manager doesn't show any new cookie from my site.
>
>
> Here is a copy from my httpd.cong file for the two servers.
>
> david1 is a mod_proxy for the mod_perl server (david)
>
> On david1 I have
> ProxyPass /login.pl http://david:8080/login.pl
> ProxyPassReverse /login.pl http://david:8080/
>
>
> On david the mod_perl server in the httpd.conf file I have
> ============================
>
> <Location /login.pl>
>         SetHandler  perl-script
>         PerlHandler Apache::TicketMaster
>         PerlSetVar  TicketDomain   david1
>         PerlSetVar  TicketSecret   /key.txt
>         PerlSetVar  TicketDatabase mysql:admin
>         PerlSetVar  TicketTable    person:user:passwd
>         PerlSetVar  TicketExpires  100
> </Location>
>
>
>
> <Directory /usr/local/systems/work/>
>         PerlSendHeader On
>         SetHandler perl-script
>         PerlHandler Apache::Registry
>         Options +ExecCGI
>
>         # OLD
>         #AuthName "Oppilaitosjärjestelmä"
>         #AuthType Basic
>         #PerlAuthenHandler Apache::AuthAny
>         #require valid-user
>         #<Limit GET POST PUT DELETE>
>         #        require valid-user
>         #</Limit>
>
>         # NEW
>         PerlAccessHandler Apache::TicketAccess
>         PerlSetVar TicketDomain david1
>         PerlSetVar TicketSecret   /key.txt
>         PerlSetVar  TicketDatabase mysql:admin
>         PerlSetVar  TicketTable    person:user:passwd
>         PerlSetVar  TicketExpires  100
>         ErrorDocument 403 /login.pl
>
>         ErrorDocument 401 /bin/admin/error/401.html
>         #ErrorDocument 403 /bin/admin/error/403.html
>         ErrorDocument 404 /bin/admin/error/404.html
>         ErrorDocument 500 /bin/admin/error/500.html
> </Directory>
>
> Any help is appreciated
>
> Scott
>