6 Replies Latest reply on Jul 6, 2012 8:34 AM by jfclere

    JBoss AS 7: How to modify the server banner

    b_prajesh

      I have a web app running in the following two setups: 1) JBoss running on Windows7 and 2) JBoss running with an apache httpd reverse proxy on CentOS.

       

      I downloaded and added jbossWebService.jar to the WEB-INF/lib directory in order to use the org.jboss.web.tomcat.filters.ReplyHeaderFilter class. Following is my filter configuration.

      <filter>

      <filter-name>CommonHeadersFilter</filter-name>

      <filter-class>

      org.jboss.web.tomcat.filters.ReplyHeaderFilter</filter-class>

      <init-param>

      <param-name>X-Powered-By</param-name>

      <param-value>MyWeb</param-value>

      </init-param>

      <init-param>

           <param-name>Connection</param-name>

           <param-value>keep-alive</param-value>

      </init-param>

      <init-param>

           <param-name>Server</param-name>

           <param-value>MyServer</param-value>

      </init-param>

      <init-param>

           <param-name>Cache-Control</param-name>

           <param-value>max-age=3600</param-value>

      </init-param>

      </filter>

       

       

      What I see in the browser:

       

      The JBoss without apache httpd shows the following:

      X-Powered-By: MyWeb, JSP/2.2

      Server: Apache-Coyote/1.1, MyServer

       

      The JBoss with apache as reverse proxy shows the following:

      X-Powered-By: MyWeb, JSP/2.2

      Server: Apache-Coyote/1.1

       

       

       

      What I want:

      The Apache-Coyote/1.1 and the JSP/2.2 to go away. The one behind apache httpd does not even show MyServer as the server banner. I would like that to show up, but that's not a necessity.

       

       

      p.s.

      In apache httpd conf file, I have

      ServerTokens ProductOnly 
      ServerSignature Off

       

      Any help is appreciated.

       

      Thanks.

      Prajesh

        • 1. Re: JBoss AS 7: How to modify the server banner
          b_prajesh

          Not sure where the filter configuration part went. Here it is again.

           

          <filter>

          <filter-name>CommonHeadersFilter</filter-name>

          <filter-class>

          org.jboss.web.tomcat.filters.ReplyHeaderFilter</filter-class>

          <init-param>

          <param-name>X-Powered-By</param-name>

          <param-value>MyWeb</param-value>

          </init-param>

          <init-param>

               <param-name>Connection</param-name>

               <param-value>keep-alive</param-value>

          </init-param>

          <init-param>

               <param-name>Server</param-name>

               <param-value>MyServer</param-value>

          </init-param>

          <init-param>

               <param-name>Cache-Control</param-name>

               <param-value>max-age=3600</param-value>

          </init-param>

          </filter>

          • 2. Re: JBoss AS 7: How to modify the server banner
            jfclere

            X-Powered-By is controled via the x-powered-by (true/false) of the jsp-configuration.

            • 3. Re: JBoss AS 7: How to modify the server banner
              b_prajesh

              Thanks! I added the configuration lines inside the web module of my standalone.xml, that is, I added them under

                  <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">

               

               

              <configuration>
              <jsp-configuration display-source-fragment="false" x-powered-by="false"></jsp-configuration>
              </configuration>

               

              The x-powered-by still shows up as JSP/2.2 - any idea?

              • 4. Re: JBoss AS 7: How to modify the server banner
                loic.villanne

                I have the same problem, with this configuration :

                <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">

                    <configuration>

                        <jsp-configuration x-powered-by="false"/>

                    </configuration>

                    <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>

                    <virtual-server name="default-host" enable-welcome-root="false">

                        <alias name="localhost"/>

                    </virtual-server>

                </subsystem>

                 

                And I see that :

                X-Powered-By: JSP/2.2

                Server: Apache-Coyote/1.1

                 

                Why the X-Powered-By isn't hidden ?

                • 5. Re: JBoss AS 7: How to modify the server banner
                  jfclere

                  the "X-Powered-By" is added by the jsp compilation. You need to touch the .jsp file to get them recompiled to the flag action.

                  • 6. Re: JBoss AS 7: How to modify the server banner
                    jfclere

                    for the Server: header see http://docs.jboss.org/jbossweb/7.0.x/sysprops.html org.apache.coyote.http11.Http11Protocol.SERVER