Before I dive into code, I need to explain our architecture. Three machines are involved: the clients are at a remote third-company site, the web-server is located in a DMZ, and we have a pubs server located inside our network that generates a PDF from xml that I send, after appliying business rules, etc.

Currently, I SFTP the file from the web server to the pubs server and redirect the client as such:

my $redirectURL = 'http://'. $destination_server . '/cgi-bin/pubtools +/ebom.' . $extension . '?XML=' . $randomName; + ## copy our XML to the correct location/filename $logger->info("Report requested, FTP $localfile to $destination_server +"); my $ftp = Net::SFTP->new($destination_server, Debug=>0); $ftp->login($login, $pass) or $logger->error("Could not connect to Pub +s Server"); $ftp->cwd($destination_path) or $logger->error("Could not change direc +tories on Pubs Server"); $ftp->put($localfile, $randomName) or $logger->error("Could not transf +er file to Pubs Server"); $ftp->site('chmod','0666',$randomName) or $logger->error("Could not ch +mod remote file"); $ftp->quit; + ## Now we redirect them to the generated PDF + $logger->info("Redirecting to $redirectURL"); + print $cgi->redirect(-target => 'ResultWindow', -expires => 'now', -ur +i=>$redirectURL);
Now, for security reasons, I can no longer let the client communicate directly to the pubs server, so everything has to go through the web server in the DMZ.

So instead of redirecting, I need to call this URL directly from the server and stream the data back to the browser. Any idea of how to do this? Thanks.


In reply to Streaming data through web server to browser with CGI by rashley

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.