Hi 2 all,and here is a problem. There is system (a perl proxy server + 10 parent-proxies) This proxy listens certain address\port and balances traffic between parents. From time to time some of upstream proxies are down. There are a bunch of scripts (black boxes that can't follow redirects) that must get their requested content. Is there a possibility, in case of a certain response, replace a content that supposed to be returned. I mean for example if response is "404":

Detect this event (Done)

Get initial URI (Done)

Return this content through another proxy ( Almost done)

Write returned content to a certain connection while it's open.

I mean if client that supposed to receive 404 error, came from 111.111.111.111:15000, content requested by this client must be returned through another proxy-parent(roundrobin will take care about "return through another parent" part) and written to a 111.111.111.111:15000 socket. Is that possible, and if possible, then how? Thanks in advance to all monks.

In reply to Http connection manipulations by kazak

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.