Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

ACS Commons Error Handler Not Working For POST

Avatar

Level 1

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" ?

1 Accepted Solution

Avatar

Correct answer by
Employee

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

View solution in original post

3 Replies

Avatar

Administrator

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

Avatar

Correct answer by
Employee

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

Avatar

Administrator

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

~kautuk



Kautuk Sahni