I have a custom FastCGI application for Nginx, and I'm struggling to get Nginx to return nothing but a 200 status code.
I tried the following:
Setting fast_cgi_intercept_errors.
Return codes through ApplicationStatusin EndRequest.
ApplicationStatus
EndRequest
Return errors in a StdError stream.
Submit any of the following headers:
"Status: 404 not found"
"HTTP / 1.1 404 not found"
"X-PHP-Response-Code: 404"
"Status: 404 not found;"
"HTTP / 1.1 404 not found;"
"X-PHP-Response-Code: 404;"
Any help would be great, I am very stuck.
, 404 fcgi ++.
#include <iostream> #include "fcgio.h" using namespace std; int main(void) { streambuf * cin_streambuf = cin.rdbuf(); streambuf * cout_streambuf = cout.rdbuf(); streambuf * cerr_streambuf = cerr.rdbuf(); FCGX_Request request; FCGX_Init(); FCGX_InitRequest(&request, 0, 0); while (FCGX_Accept_r(&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(&cin_fcgi_streambuf); cout.rdbuf(&cout_fcgi_streambuf); cerr.rdbuf(&cerr_fcgi_streambuf); cout << "Status: 404\r\n" << "Content-type: text/html\r\n" << "\r\n" << "<html><body>Not Found</body></html>\n"; } cin.rdbuf(cin_streambuf); cout.rdbuf(cout_streambuf); cerr.rdbuf(cerr_streambuf); return 0; }
nginx "HTTP/1.1 304 Not Modified\r\n".
"HTTP/1.1 304 Not Modified\r\n"
nginx ( ) Status.
Status
fastcgi "Status: 304\r\n".
"Status: 304\r\n"
:
HTTP/1.1 304 Server: nginx/1.6.2 Date: Sat, 21 May 2016 10:49:27 GMT Connection: keep-alive
, Status: 304. nginx.
Status: 304
Source: https://habr.com/ru/post/1527290/More articles:Threading Issues - cHow to require a user-installed ruby gem when a system-wide gem with a higher version is also available? - ruby | fooobar.comSetting environment variables to run the Eclipse IDE - javareplace "[using [and]" with] json - jsonStream security - reading mutable objects (java) - javaКонтроллер камеры первого лица Libgdx - javaMixPanel for error monitoring - androidMultiple Transactions - paypalКак мы можем перезагрузить консоль парусов? - javascriptinstalling APK via ADB emulator freezes - performanceAll Articles