[jboss-jira] [JBoss JIRA] (WFLY-4837) Content-Type header not sent by Undertow error-page filter

Brian Riehman (JIRA) issues at jboss.org
Fri Jun 26 17:50:03 EDT 2015


Brian Riehman created WFLY-4837:
-----------------------------------

             Summary: Content-Type header not sent by Undertow error-page filter
                 Key: WFLY-4837
                 URL: https://issues.jboss.org/browse/WFLY-4837
             Project: WildFly
          Issue Type: Bug
          Components: Web (Undertow)
    Affects Versions: 9.0.0.CR2, 8.2.0.Final
            Reporter: Brian Riehman
            Assignee: Stuart Douglas
            Priority: Minor


The Content-Type header is not sent by the error-page filter handler. This This does not appear to be configurable and is problematic when operating Wildfly behind an Apache instance where the Content-Type "text/plain" is added. This forces the content to be displayed as text even if it is HTML.

Here is the undertow subsystem configuration:

{code:xml}
        <subsystem xmlns="urn:jboss:domain:undertow:1.2">                                                                                                                                                      
            <buffer-cache name="default"/>                                                                                                                                                                     
            <server name="default-server">                                                                                                                                                                     
                <http-listener name="default" socket-binding="http"/>                                                                                                                                          
                <host name="default-host" alias="localhost">                                                                                                                                                   
                    <location name="/" handler="root-html" />                                                                                                                                                  
                    <location name="/images" handler="images"/>                                                                                                                                                
                    <filter-ref name="404-handler" predicate="true"/>                                                                                                                                          
                    <filter-ref name="fail-content-type" predicate="equals[%{RESPONSE_CODE}, 404]"/>                                                                                                           
                </host>                                                                                                                                                                                        
            </server>                                                                                                                                                                                          
            <servlet-container name="default">                                                                                                                                                                 
                <jsp-config/>                                                                                                                                                                                  
                <websockets/>                                                                                                                                                                                  
            </servlet-container>                                                                                                                                                                               
            <handlers>                                                                                                                                                                                         
                <file name="images" path="/var/www/images"/>                                                                                                                                                   
                <file name="root-html" path="/var/www/html"/>                                                                                                                                                  
            </handlers>                                                                                                                                                                                        
            <filters>                                                                                                                                                                                          
                <response-header name="fail-content-type" header-name="Content-Type" header-value="text/html"/>                                                                                              
                <error-page name="404-handler" code="404" path="/var/www/error/404.html"/>                                                                                                                     
            </filters>                                                                                                                                                                                         
        </subsystem> 
{code}

You can see that we attempted to place a filter on the host to set the Content-type header if a 404 response code was received. However, after debugging the undertow subsystem, we found that the HttpServerExchange value in EqualsPredicate had a response code of 200 at the time the predicate was evluated.

This behaves the same in Wildfly 8.2.0 and Wildfly 9.0.0 CR2.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


More information about the jboss-jira mailing list