FastCGI and Nginx - Return HTTP Status -


Behind Nginx I have a custom FastGI application and I am struggling to return NGX to anything except 200 status codes.

I have tried the following:

  • Setting up fast_cgi_intercept_errors.

  • "Status: 404 Not Found"

  • "HTTP / 1.1 404 not found"

    "X-PH-Response-Code: 404"

  • "Status: 404 Not Found;"

  • "HTTP / 1.1 404 not found;"

  • "X-PH-Response-Code: 404;"

    Any help will be great, I am very stuck.

    Here is an example of how you can return the 404 status code through FCG and C ++ Are there.

      #include & lt; Iostream & gt; #include "fcgio.h" using the namespace std; Int main (zero) {streambuf * cin_streambuf = cin.rdbuf (); Streambuff * cout_streambuf = cout.rdbuf (); Streambuff * cerr_streambuf = cerr.rdbuf (); FCGX_Request request; FCGX_Init (); FCGX_InitRequest (and request, 0, 0); While (FCGX_Accept_r (and request) == 0) {fcgi_streambuf cin_fcgi_streambuf (request.in); Fcgi_streambuf cout_fcgi_streambuf (request.out); Fcgi_streambuf cerr_fcgi_streambuf (request.err); Cin.rdbuf (& amp; cin_fcgi_streambuf); Cout.rdbuf (& amp; cout_fcgi_streambuf); Cerr.rdbuf (& amp; cerr_fcgi_streambuf); Cout & lt; & Lt; "Status: 404 \ r \ n" & lt; & Lt; "Content-Type: Text / html \ r \ n" & lt; & Lt; "\ R \ n" & lt; & Lt; "& Lt; html> gt; body & gt; not found & lt; / body & gt; & lt; / html & gt; \ n"; } Cin.rdbuf (cin_streambuf); Cout.rdbuf (cout_streambuf); Cerr.rdbuf (cerr_streambuf); Return 0; }    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -