1 Reply Latest reply on Jun 14, 2018 9:03 AM by Greg Jewell

    Virtual directory for static content

    Charles Johnson Newbie

      I am trying to set up a virtual directory on my wildfly server, for serving up static content.

      in accordance with instructions I have found on various sites I set up a handler in my standalone.xml, as follows:

              <subsystem xmlns="urn:jboss:domain:undertow:3.1">

                  <buffer-cache name="default"/>

                  <server name="default-server">

      .........

                  </server>

                  <handlers>

          <file name="/images" path="c:/test" directory-listing="true"/>

      </handlers>

       

      The assumption is that I can now navigate to https://localhost:8443/images/jackolantern.jpg and access that file, but it does not work, I receive a 404 error from the server.

       

      Is this set up correctly? Am I missing an additional setting?

        • 1. Re: Virtual directory for static content
          Greg Jewell Novice

          The snippet you posted doesn't show where you are actually referencing the handler, and defining the URL path where that static content can be reached.

           

          <server name="default-server">

            <host name="default-host" alias="localhost">
              <location name="/images" handler="images"/>
            </host>

              .........

          </server>

           

          Additionally, you need to remove the leading slash from the file handler name.  You are trying to set a path there, where it's just supposed to be a name that's referenced.