[ 
https://issues.apache.org/jira/browse/SLING-13413?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Carsten Ziegeler updated SLING-13413:
-------------------------------------
    Description: 
Right now, when a request to a non-HTML resource fails, the registered 
ErrorHandler is used - which usually is the SlingServletResolver delegating to 
a script registered in the resource tree.
The default built-in scripts as well as most of the custom script are notĀ built 
to explicitly handle requests to non-HTML resources and therefor always returns 
either JSON (if the accept header indicates JSON) or HTML for eveything else.

In that case, a request to /content/non-existing-image.png will often returns 
the HTML error page, even if the browser indicated in the accept header, that 
it won't handle text/html for this request. Next to potential security problems 
this can cause performance problems if the creation of the error page is 
expensive.

We need to have a dedicated handling for non-JSON and non-HTML responses, which 
just set the statuscode. No response body is required in these cases.

  was:
Right now, when a request to a non-HTML resource fails, the DefaultErrorServlet 
is resolved, which in most cases is not built to explicitly handle requests to 
non-HTML resources and therefor always returns either JSON (if the accept 
header indicates JSON) or HTML for eveything else.

In that case, a request to /content/non-existing-image.png will often returns 
the HTML error page, even if the browser indicated in the accept header, that 
it won't handle text/html  for this request. Next to potential security 
problems this can cause performance problems if the creation of the error page 
is expensive.

We need to have a dedicated handling for non-JSON and non-HTML responses, which 
just set the statuscode. No response body is required in these cases.


> Provide different error handlers for non-HTML/non-JSON requests
> ---------------------------------------------------------------
>
>                 Key: SLING-13413
>                 URL: https://issues.apache.org/jira/browse/SLING-13413
>             Project: Sling
>          Issue Type: Improvement
>          Components: Engine, Servlets
>    Affects Versions: Engine 3.0.4, Servlets Resolver 3.0.10
>            Reporter: Joerg Hoh
>            Assignee: Joerg Hoh
>            Priority: Major
>
> Right now, when a request to a non-HTML resource fails, the registered 
> ErrorHandler is used - which usually is the SlingServletResolver delegating 
> to a script registered in the resource tree.
> The default built-in scripts as well as most of the custom script are notĀ 
> built to explicitly handle requests to non-HTML resources and therefor always 
> returns either JSON (if the accept header indicates JSON) or HTML for 
> eveything else.
> In that case, a request to /content/non-existing-image.png will often returns 
> the HTML error page, even if the browser indicated in the accept header, that 
> it won't handle text/html for this request. Next to potential security 
> problems this can cause performance problems if the creation of the error 
> page is expensive.
> We need to have a dedicated handling for non-JSON and non-HTML responses, 
> which just set the statuscode. No response body is required in these cases.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to