Skip to content Skip to sidebar Skip to footer

How To Programmatically Communicate With Apache?

So many web applications these days run on their own microservers, it can be hard to implement them on shared hosting platforms. The apps listen on a dedicated port you can customi

Solution 1:

Your Python project is a reverse proxy, and the API you're looking for is just ordinary HTTP. (After all, that's how web browsers interact with Apache already...)

To make HTTP requests, you need a client like urllib or requests:

importrequestsresponse= requests.get("http://" + apache_host + ":8080/" + parsed_path)

By default, all your apps and microservers will think that all clients come from localhost. If that's a problem, see if your apps accept the X-Forwarded-For header. (If they do, include it in all your requests.)

Post a Comment for "How To Programmatically Communicate With Apache?"