AEM always returns 200 status code. | Community
Skip to main content
janellic4
Level 2
August 29, 2019
Solved

AEM always returns 200 status code.

  • August 29, 2019
  • 34 replies
  • 25940 views

Upon requesting non-existent pages, both aem author and publish instances return blank page with 200 status code. The default 404 error page is not showing.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by leoberliant

Do you have any custom filters that can possibly massage the response? You might want to stop your custom bundles in OSGi and use /system/console/requests to track recent requests.

34 replies

janellic4
janellic4Author
Level 2
August 29, 2019

Update for the curl command: I get 200 status for both the valid and invalid url request.

Response for requesting the valid url : http://localhost:4503/content/myproject/en/search-results.html

HTTP/1.1 200 OK

Date: Thu, 29 Aug 2019 21:45:38 GMT

X-Content-Type-Options: nosniff

Set-Cookie: cq-authoring-mode=TOUCH;Path=/;Expires=Thu, 05-Sep-2019 21:45:38 GMT

Expires: Thu, 01 Jan 1970 00:00:00 GMT

Content-Type: text/html;charset=utf-8

Transfer-Encoding: chunked

Response for the invalid url: http://localhost:4503/content/myproject/en/no-page.html

HTTP/1.1 200 OK

Date: Thu, 29 Aug 2019 21:46:15 GMT

X-Content-Type-Options: nosniff

Set-Cookie: cq-authoring-mode=TOUCH;Path=/;Expires=Thu, 05-Sep-2019 21:46:15 GMT

Expires: Thu, 01 Jan 1970 00:00:00 GMT

Content-Length: 0

Umesh_Sondhi
Level 4
August 30, 2019

hi janellic4 ,

This link can help you understand why you are getting 200 and not 404 response .

https://experiencemanaged.com/posts/efficient-error-handling-with-aem-dispatcher-and-apache-web-server.html

Thanks 

Himanshu_Singhal
Community Advisor
Community Advisor
August 30, 2019

That could be due to Response buffer size as well that you always get 200 instead of any other error code. If the rendered response buffer is more than defined one, then server send response back to browser in chunks and once it's sends a part of response, no matter if page works or not, if always return 200.

You can try increasing the buffer size by going into configuration:

Apache Felix Jetty Based Http Service

"Response Buffer Size"

Increase the size and if page throws error then it should get displayed as well.

cal-netsolution
Level 2
August 30, 2019

Can you try creating the error pages using ACS commons error page handler.

https://adobe-consulting-services.github.io/acs-aem-commons/features/error-handler/index.html

In this article there is step by step process to create custom error pages and also settings in dispatcher.

Error Page Handler

https://adobe-consulting-services.github.io

Best,

Cal

janellic4
janellic4Author
Level 2
August 30, 2019

Hi, Umeshsondhi

Thank you for your reply. I have read the article you mentioned.  In localhost, I do not use a dispatcher. It seems that a blank page would always be returned by Publish for invalid url request. I don't know how this blank page is created.

janellic4
janellic4Author
Level 2
August 30, 2019

Hi himanshusinghal,

Thank you for your response. I tried to increase the Response Buffer Size, then click Save. I got a request error as following:

janellic4
janellic4Author
Level 2
August 30, 2019

Hello cal-netsolutions,

Thank you for your suggestion. However, we have implemented a custom error handler. It works fine in Publish instance in another computer. It does not work in some computers and the stage. They have the same problem: invalid url always got 200 status code with blank page.

Himanshu_Singhal
Community Advisor
Community Advisor
September 1, 2019

Hi janellic4,

While saving the configuration, it displays the error but it saves the updated value. Try opening the value again and it should show updated "Response Buffer Size".
Even after increasing the response buffer size, do you still get the 200 status code?

Do you get any error as well in logs?

janellic4
janellic4Author
Level 2
September 3, 2019

Hi himanshusinghal,

Yes, I still got the 200 status code even after I doubled the response buffer size.

Himanshu_Singhal
Community Advisor
Community Advisor
September 3, 2019

Could you please try increasing the buffer size to lets say 10000 and try again?