2

We are currently using HTTPD server (apache) to handle client request. The requests are further proxied to a Application Server (glassfish) which provides the content. The content are static files (software images). Below is the ProxyPass directive used.

ProxyPass /access/sw http://localhost:8080/access/sw

We would like Apache to handle static contents as its frees up the glassfish to do other jobs. The only issue with this is the request still needs to be directed to the glassfish to check for business logic. The glassfish server after running the business logic should send a response back to Apache confirming that the client is allowed to download the software image. It can also send a negative reponse back to Apache to reject the clients request.

How can this be achived? Are there any apache modules to handle this? Just to reiterate, is the below achieveable?

Request from client -> Apache -> Glassfish (runs the business logic) -> responds back to Apache if client should be allowed to download -> Apache serves the static file depending on glassfish response

P.S - Client cannot handle redirect requests. Client sends a single GET

  • The problem is the content you are serving is not really static as you are hitting a servlet which checks if it is ok to download a file or not. I'm afraid out of the box there is no _clap your hands_ solution to this. Anyway you question is interesting :) – alphamikevictor Apr 24 '15 at 11:24
  • @alphamikevictor Yeah, I am aware that there isn't a OOB solution. But any other solution that you can think off? – TheMonkWhoSoldHisCode Apr 24 '15 at 11:32

1 Answers1

2

Just thinking out loud. I can think about 2 scenarios.

The first one is you are allowed to use PHP (or python, ruby ...) on your apache.

Just make the user request a PHP script when downloading a file, then your php will make a request to glassfish saying (is this user allowed to download this software?) if it is ok then serve from PHP your request otherwise response with a 403 (Forbidden).

The second one will be performing the same as above but in the form of an apache module.

alphamikevictor
  • 1,062
  • 6
  • 19