Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Cookie Complexities

by tradez (Pilgrim)
on Jun 17, 2002 at 21:11 UTC ( #175189=perlquestion: print w/replies, xml ) Need Help??
tradez has asked for the wisdom of the Perl Monks concerning the following question:

My Fellow Monks, I am a sysadmin / engineer for an ISP and we have a website appropriately named "Vertex" that myself and a few other Monks, Russ, Super Monkey, and Jerry all have spent some time on. Recently I started trying to setup a aptly named "My Vertex" configuration tool to scope the look and feel to a more per-user based, um basis ;). Cookies seemed like the right way so I read up on them, implemented and everything was grand, cept one thing. The domain of these cookies has to be static. My ISP covers 15 markets and hence has 15 sub-vertexs subdomains as such: phoenix-vertex.*******.net, fresno-vertex.*****.net, etc... The current way I have thought of was just having a centralized place for configuring cookies, and each time a user logs into one of the other boxes, the cookies for that box are fetched, if they exist, the user enters with a configured looks. ELSE, they are redirected to the central location, with the return url passed via CGI, then central location checks to see if they have a config, then passes it back via CGI so that they can be set locally on the first accessed box. If they do not have them set, they are sent to a configuration page, then so on and so forth.
  My question for the monistary is if anyone else has tried to achieve the same goal I have in a different manor, or if there is something I am over looking that simplify this whole ordeal. Any help will be much appreciated.

"Never underestimate the predicability of stupidity"
- Bullet Tooth Tony, Snatch (2001)

Replies are listed 'Best First'.
Re: Cookie Complexities
by Aristotle (Chancellor) on Jun 17, 2002 at 23:00 UTC
    It should be possible to set the cookie domain to '' - all servers below that domain will be sent that cookie then.
    $c = new CGI::Cookie(-name => 'foo', -value => 'bar', -expires => '+3M', -domain => '', -path => '/cgi/foo/bar' -secure => 1 );
    Makeshifts last the longest.
Re: Cookie Complexities
by gumby (Scribe) on Jun 17, 2002 at 21:28 UTC
    I might have a solution for this, but I need some more information on you're setup.

    Update: Ok, I remember it now. See below...

      I recall a fairly elegant solution to this is to link to $ using Apache set up for wildcard DNS. This keeps the $userid persistent across domains, whilst being easy to extract.
Re: Cookie Complexities
by BUU (Prior) on Jun 17, 2002 at 22:58 UTC
    why not just set the cookies on "*****.net" ? Granted this would give the site at "*****.net" access to them, but as long as you A) name them appropiately* and b) store fairly harmless values in them it should be a problem. Another thought is to have one "main" site at a static location, then have everything else bounce to there.

    *name them so they dont conflict with any common cookie names that "*****.net" might be using. Friendlyness

    And why did you star out "*****.net"
      I have tried this, and setting the domain to does not allow cross subdomain usage. Think of it like if someone a set a cookie for, that would a security issue. Also, starred out the url cause it is an intra company site that is publicly accessible but for NDA reasons, I would like to not make it public to the perl community

      "Never underestimate the predicability of stupidity"
      - Bullet Tooth Tony, Snatch (2001)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://175189]
Approved by Aristotle
and the shadows deepen...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2016-12-07 23:49 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (133 votes). Check out past polls.