0

I'm trying to run a CGI application via Apache2, with the goal of Apache2 launching the application and then simply passing data back and forth for as long as the CGI keeps running. This is a custom application protocol.

I've tried no parse headers (NPH), where your CGI application starts with a line like "HTTP/1.1 200 OK", but Apache2 is returning internal error 500 when I try to do that. Is there some option to set to allow NPH headers?

Otherwise, how can I get Apache2 to launch an application and just go into a dumb transparent passthrough mode?

I'd like to avoid actually adding sockets to the application to run as a daemon and having mod_proxy or something do redirects to that daemon. Then I'd have to manage starting/killing instances of that, when Apache2 does a great job with CGI and so on as is.

EDIT 1 Ah, looking at the mod_cgi.c source code I figured out that renaming the CGI application with a "nph-" prefix enables the NPH mode. So, now it's passing through exactly what I sent from the CGI application, live... but it's not passing the client-side's data to the CGI app. I've tried GET and POST so far...

EDIT 2 Apache2 is closing stdin before calling the CGI application. How do I get Apache2 to continue to pass data from the client/requestor over stdin, instead of closing it? Is it possible to do so?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.