Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

We're trying to understand how to set up a proxy server for our Web application. We need several processes to access the Internet through a proxy server in the internal network. Ideally, we could run custom Python code somewhere inside the proxy - especially before actually executing the request.

Clarification based on comments: We are not trying to just use the proxy: we want to run custom code in the proxy to keep track of the request - response process.

This is probably a really basic / dumb question, but now that I know that we should probably use a proxy, I am struggling to understand how they work and how we should incorporate them to our infrastructure.

We would need to do things like modify the requested URL before it's fetched, modify request headers and payload and possibly get some of the response data after the payload has been fetched.

Thanks very much! Any information on this will be very appreciated!

share|improve this question

closed as off topic by Michael Hampton, Zoredache, Ward, kce, Jenny D May 2 '13 at 8:24

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
What are you trying to accomplish specifically? "How does a proxy server work" is too open-ended and will get this question closed by the mods. –  tdk2fe May 1 '13 at 20:28
    
This is much too broad for us to answer. Instead, ask how you can write code to access URLs via a proxy in the language of your choice - on our sister site Stack Overflow, and only if such a question and answer doesn't already exist. –  Michael Hampton May 1 '13 at 20:36
    
I added some clarification. I did ask this question in StackOverflow, but it got closed. I believe just getting some information on WHAT I should be asking about would be good. I am ignorant as to the process that goes on inside a proxy server (Does it somehow rewrite headers? Does it generate a new request? Where should I plug in my code? - Things like that), so I'm trying to get information like that. Thanks for your comments. –  Juan Carlos Coto May 1 '13 at 20:41
    
@MichaelHampton Also, we don't want to just USE a proxy; we want to be able to customize that proxy to use some of our code while it's working. –  Juan Carlos Coto May 1 '13 at 20:42
    
If you want to write your own proxy server, that's not only too broad, it's also something we don't do at Server Fault. :) –  Michael Hampton May 1 '13 at 21:12

1 Answer 1

Take a look at an existing proxy server nginx (usually a reverse proxy) or squid (usually a forward proxy).

I'd recommend modifying one of those to suit your needs.

share|improve this answer
    
Thanks. Any ideas for one that we could use that enables Python plugins? Do those? –  Juan Carlos Coto May 1 '13 at 22:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.