I am using the following CGI packages

use CGI; use CGI::Session;

Google has not been a friend in this quest, turning up much more noise than anything else. Here is what I tried:

print $cgi->header(-cookie=>$tokcookie); print $cgi->redirect( -location => $base_url, -cookie => $cookie

And here is the HTML I got.

<html> <head></head> <body>Status: 302 Found Set-Cookie: CGISESSID=5b74d67873211375e3aef2ed +004bd22d; path=/; expires=Sat, 22-Aug-2015 03:04:12 GMT Date: Sat, 22 + Aug 2015 02:34:12 GMT Location: https://gateway.onsoftarchpayments.c +om/cgi-bin/np.pl </body> </html>

Firebug actually claims no cookie was received. In the body of the HTML I received, I see the value of the variable $cookie. However, it seem the cookie in $tokcookie is lost.

I really need be able to pass two cookies, as the $cookie is my session cookie, which is used for the obvious purpose. The cookie $tokcookie is a special cookie used to defend against cross site request forgery (check out the OWASP web site if you're curious about this, but the details are not relevant for this question). This cookie, too, is essential.

I have been through all the documentation I could find for this, and while there are lots of examples/discussion or passing one cookie in a redirection using function $cgi->redirect, I have yet to find any discussion or mention of passing two cookies in a redirection. Hence the question: "What do I need to change in order to be able to pass two cookies in this redirection?"

Thanks

Ted


In reply to Submiting multiple cookies on a redirect - how? by ted.byers

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.