I'm in the process of writing a transparent HTTP proxy in PERL.
Essentially I'd like this to sit between the web server and the app server and act as sort of a "2nd proxy" that provides a lot more detailed request manipulation logic than I can get out of the proxy modules in Apache or NGINX or something.
To start with, I've considered going with an existing module like HTTP::Proxy, or attempting to augment NGINX or Apache to accomplish this, but for a couple or reasons I'd rather not get into, I'd rather stick with writing my own, so lets just assume that's the way I need to go for the purposes of this discussion.
Essentially I'm "catching" the request via standard CGI, manipulating it and/or routing it based on some pretty obscure logic and then reformulating the request with LWP and then spitting the response back to the upstream webserver, which turns around and hands it to the browser... dumb I know, but this is a dumb situation.
I have pretty much everything working, standard GET/POST requests, 302/301 redirects, etc... but the one place I'm having trouble that I can't figure out is how to pass cookies through this layer.
So if I have an app that is hidden behind a login screen, how do I pull the session cookie out of the standard HTTP::Response object I get when I post the login form and get that back to the browser?
Any ideas are *super* appreciated!!!!
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.