ACS Commons Error Handler Not Working For POST | Community
Skip to main content
January 6, 2017
Solved

ACS Commons Error Handler Not Working For POST

  • January 6, 2017
  • 3 replies
  • 2029 views

Hello,

We have implemented ACS Error Handler for our project. Lets say that my hierarchy starts from "/content/myproject" and we have set the errorPages property on "myproject" page then the ACS error handler works fine for all the pages UNDER "myproject". How do we make it work for POST requests on content pages where we get 500 or 403 errors?

Example: How do I set the error handler for POST on URLs like "http://www.mysite.com/any-page.html" ?

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 davidjgonzalezzzz

SushantRao,

ACS Commons Error Page Handler works fine for POSTs as well. If an error occurs, Sling handles the error and passes it off to the ACS Commons Error Page handle, which in turn internally makes a HTTP GET request for the error page defined by the @errorPages property.

The problem your running into it seems, is you are making POSTs that may "error" (403/500) to paths that dont reside under a hierarchy that that defines a @errorPages, thus the error page to display is ambiguous.

You can set a "System" default for ACS Commons error page handler via OSGi configuration which is described in the ACS Commons Error Page Handler documentation; this can be used to surface error pages for request where a @errorPages cannot be found.

... 

Taking a step back, its better practice to bind your POST actions to actual content resources, rather than to arbitrary content endpoints or path-based servlets.

For example:

Good: HTTP POST /content/my-project/actionable-page.some-action.html

Bad: HTTP POST /some-action.html

3 replies

kautuk_sahni
Community Manager
Community Manager
January 6, 2017

Hi

See the comments here - : https://adobe-consulting-services.github.io/acs-aem-commons/features/errorpagehandler.html

//  Increasing the Response buffer size in Apache Felix Jetty Based HTTP Service to 49152 fixed it.

Also you can you post your question directly in the comment section of the page.

I hope this would help you.

~kautuk

Kautuk Sahni
davidjgonzalezzzzAdobe EmployeeAccepted solution
Adobe Employee
January 6, 2017

SushantRao,

ACS Commons Error Page Handler works fine for POSTs as well. If an error occurs, Sling handles the error and passes it off to the ACS Commons Error Page handle, which in turn internally makes a HTTP GET request for the error page defined by the @errorPages property.

The problem your running into it seems, is you are making POSTs that may "error" (403/500) to paths that dont reside under a hierarchy that that defines a @errorPages, thus the error page to display is ambiguous.

You can set a "System" default for ACS Commons error page handler via OSGi configuration which is described in the ACS Commons Error Page Handler documentation; this can be used to surface error pages for request where a @errorPages cannot be found.

... 

Taking a step back, its better practice to bind your POST actions to actual content resources, rather than to arbitrary content endpoints or path-based servlets.

For example:

Good: HTTP POST /content/my-project/actionable-page.some-action.html

Bad: HTTP POST /some-action.html

kautuk_sahni
Community Manager
Community Manager
January 9, 2017

Thanks a lot David Gonzalez. This is an excellent information added here.

~kautuk

Kautuk Sahni