Error writing content through Apache - apache

I am streaming out data (sometimes png, sometimes json, sometimes xml) and I get the following error in Chrome:
Error 321 (net::ERR_INVALID_CHUNKED_ENCODING): Unknown error.
I do not get this error when apache is not in front of my Tomcat web application (servlet), only when I deploy it to our test environment which has apache running.

I've looked everywhere for an answer to this question, I'm going to put the answer here:
The header entry:
Transfer-Encoding:chunked, chunked
was causing this error when the response was returned through Apache. Without Apache in front everything worked fine.
Should be:
Transfer-Encoding:chunked

Related

Browser cannot get reponse from fuseki if a long running query is executed

Recently I have configured a reverse proxy(apache2 in ubuntu 16) for fuseki2 as a web application using tomcat7. However, there is a problem still confusing me that I can only get results if I execute some simple queries which don't need a long processing time (less than 10mins in chrome exactly) from the backend. I will otherwise get a print of "unable to get a response from endpoint". The timeout is strictly 10mins. I have increased the timeout for fuseki2 as well as the reverse proxy, but this doesn't work for me.
I have traced the error.log in apache2 and catalina.out in tomcat and found no error. Besides, Tomcat is keep runing when "no response" error appears in Chrome.
Anyone has any idea about this? Any help or hint will be appreciated.

CORS issues with vue/node to rack/thin via nginx

I had this working properly and all of a sudden during a restart stopped working and I can't get to the bottom of what happened.
Basically, vue/node (dev) mode is using http but the ajax uses https to the server.
Server responds with all headers including Access-Control-Request-Origin and I can see json data response from the server in the firefox dev tools
But for some reason it throws an Error: Network Error alert. Inspecting in dev tools I find
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://r.roller.lan/workstations?session_token=2de63puojmt3ubkfp94c3ohm45. (Reason: CORS header “Access-Control-Allow-Origin” does not match “https://devv.roller.lan:8080”)
I am making request from http://devv.roller.lan:8080 and somewhere in the chain gets translated to https:// which doesn't match?
Thanks
Everything works as expected after I added highlighted portion from the Nginx Reverse Proxy article Koshux referenced to the nginx conf.

How to debug a 404 error on apache server ( lamp )?

I came across 404 error a few times and i have difficulties in debugging this kind of problem.
What is the strategy and tools available to analyse such problems (firebug, logs...).
How to differentiate and fix the cause ?
page not existing ,wrong path , redirection and rewriting ,server problem ...
404 error code means that a file is not found for whatever reason.
Just check that the file exists and that the path you use is right.
You can analyse sent requests and received responses headers and body in your browser's developper console if you want more details about why some request failed.

Apache custom dynamic error response

I've seen hundreds of pages explaining how to create custom error pages in Apache 2 server. My question is different. I have a web application running in Apache (it is a ISAPI DLL, but it could also be a CGI executable). My application can handle internal server errors and generate a detailed error message (for instance, include a full stack trace), included in the response together with error code 500. AFAIK, Apache just let me use redirection in order to display custom error messages: http://httpd.apache.org/docs/2.2/custom-error.html
HTTP spec (RFC 2616 - section 10), not only allows but also recommend that detailed error message should be included in the BODY section of the response in case of error code > 500.
Link: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5
Seems that Apache won't let my custom error message go to the browser, and always replace it with its own internal error message and I believe that it is not the correct behavior, based on RFC 2616.
So my question is: Is there any setting in Apache server that will let my custom message go to the browser? Or, is there anything that can be done in my application that will instruct Apache to send my custom error message (something like some specific header field in the response)?
More on the subject:
When my ISAPI application returns error code 500, with other error information in the response body, Apache replaces it with its standard "500 Internal Server Error" message/HTML content, and inside Error.log file I can see the "useless" "Premature end of script headers" message. I'm deeply sure that my headers are fine, including the Content-Type field.
If I replace the 500 error code with any other server error code (e.g. 501) it works flawlessly and my response goes to the browser as is. The same header is sent to the Apache server, only the error code is different (501, instead of 500). With this test result in mind, one of these two must be true:
1- Apache requires some specific header field when status code is 500
2- Apache won't let custom error messages with status code 500 go to the browser.
I don't see any other alternative.
I think you're conflating two questions. You can generate a 500 response with a CGI script and include your custom body. Or you can override any 500 with any resource you want.
If you're failing to do the former, it's likely because of some subtle thing in the ISAPI interface between Apache and your module. Desk-checking the code says you should be able either set the pseudo
Status: 500
Header, or basically return any ISAPI error and end up with a 500 and your custom body.
Apache has two notions of a status code -- the one in the status line (r->status) and an error code returned separately from the module that handles the request (return HTTP_INTERNAL_SERVER_ERROR, return r->status).
When the former is used as the latter is when the custom error messages get lost. All of that happens in./modules/arch/win32/mod_isapi.c in Apache. Whatever is going on, it is ISAPI unique.

Apache upload failed when file size is over 100k

Below it is some information about my problem.
Our Apache2.2 is on windows 2008 server.
Basically the problem is user fails to upload file which is bigger than 100k to our server.
The error in Apache log is: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. : Error reading request entity data, referer: ......
There were a few times (not always) I could upload larger files(100k-800k, failed for 20m) in Chrome. In FF4 it always fails for uploading file over 100k. In IE8 it is similar to FF4.
It seems that it fails to get request from client, then I reset TimeOut in Apache setting to default value(300) which did not help at all.
I do not have the RequestLimitBody option set up and I am not using PHP. Anyone saw the similar error before? Now I am not sure what I can try next. Any advise would be appreciated!
Edit:
I just tried to use remote desk to upload files on the server and it worked fine. First thought was about the firewall which however is off all the time, Http Proxy is applied though.