logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Allow 2 modules to handle the same web request
Author
angel



Joined: 13 Oct 2016
Posts: 3

PostPosted: Fri 14 Oct '16 5:37    Post subject: Allow 2 modules to handle the same web request Reply with quote

Some of my HTTP requests are not simple file requests. They require some sort of computation at Server side. Can I configure Apache to pass those request to a simple PHP script first, (so that PHP script can set some Env parameter) then (Apache to) pass the request to a fastcgi module, and collect the response from the fastcgi module and send back to the client?

By default, a request such as
Code:
https://www.example.com/cgi/fcgi/SpecialProcessing/abc/def

will be directly routed to the fast cgi module. Anyway to make this request to a PHP handler first then the fast cgi module?

I have tried to make the PHP script calling the fastcgi module directly without Apache's help. Sadly in this case the fastcgi module's response won't be picked up by Apache and sent back to client.
Back to top
maba



Joined: 05 Feb 2012
Posts: 64
Location: Germany, Heilbronn

PostPosted: Fri 14 Oct '16 8:11    Post subject: Reply with quote

You could always do the preprocessing from you FastCGI processor. Environment variables can be set in every programming language, so I am not exactly sure why you would even want a double processing.

The concepts sounds strange.
Back to top
angel



Joined: 13 Oct 2016
Posts: 3

PostPosted: Fri 14 Oct '16 8:32    Post subject: Reply with quote

The PHP script will do some Database search based on some header info in the request and pass the result to the FastCGI module as a parameter (through Environment variables). It is not a simple if-else thing which I might be able to use Apache Directive to do it in Apache config file.

Of course one might argue that the FastCGI module itself can do the Database search. But we already have the code ready and tested in PHP script and now just try to integrate it with an existing FastCGI module.

Thank you.
Back to top
angel



Joined: 13 Oct 2016
Posts: 3

PostPosted: Fri 14 Oct '16 12:26    Post subject: Reply with quote

Or maybe I should ask, what is the proper way in Apache to verify a bearer token, identify the user id from the bearer token and if the request is verified, pass the request to a FastCGI module (in C) for processing?

I am currently using PHP scripts to generate the Tokens, so would like to use the same set of script(s) to verify the tokens.
Back to top


Reply to topic   Topic: Allow 2 modules to handle the same web request View previous topic :: View next topic
Post new topic   Forum Index -> Apache