Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1128

Undertow not serving local content on Windows 10

XMLWordPrintable

    • Hide

      See code

      Show
      See code

      I'm using the following code to create my undertow based web server:

      {{ DeploymentInfo servletBuilder = Servlets.deployment()
      .setClassLoader(OpenUnisonOnUndertow.class.getClassLoader())
      .setEagerFilterInit(true)
      .setContextPath("/")
      .setDeploymentName("openunison")
      .addFilter(

      Servlets.filter("openunison",com.tremolosecurity.openunison.OpenUnisonServletFilter.class)
      .addInitParam("mode", "appliance")

      )
      .addFilterUrlMapping("openunison", "/*", DispatcherType.REQUEST)
      .setResourceManager(new FileResourceManager(new File(config.getPathToDeployment() + "/webapp"),1024))
      .addServlet(JspServletBuilder.createServlet("Default Jsp Servlet", "*.jsp"))
      .addServlet(
      Servlets.servlet("identityProvider",com.tremolosecurity.idp.server.IDP.class)
      .addMapping("/auth/idp/*")
      );

      JspServletBuilder.setupDeployment(servletBuilder, new HashMap<String, JspPropertyGroup>(), new HashMap<String, TagLibraryInfo>(), new HackInstanceManager());

      DeploymentManager manager = Servlets.defaultContainer().addDeployment(servletBuilder);
      manager.deploy();

      PathHandler path = Handlers.path(Handlers.redirect("/"))
      .addPrefixPath("/", manager.start());

      buildUndertow.setHandler(path);

      undertow = buildUndertow.build();
      undertow.start();}}
      Here's a link to the source : https://github.com/TremoloSecurity/OpenUnison/blob/1.0.12/unison/openunison-on-undertow/src/main/java/com/tremolosecurity/openunison/undertow/OpenUnisonOnUndertow.java

      This works great on Linux (I have it running on Fedora 25 and RHEL 7), but on Windows Undertow doesn't want to serve any content outside of the servlet being registered, everything is a 404. I verified that the paths are correct. Here's the only log being generated:

      {{[2017-07-03 03:21:22,803][ActiveMQ Journal Checkpoint Worker] DEBUG MessageDatabase - Checkpoint started.
      [2017-07-03 03:21:22,805][ActiveMQ Journal Checkpoint Worker] DEBUG MessageDatabase - Checkpoint done.
      [2017-07-03 03:21:24,264][XNIO-1 I/O-2] DEBUG request - Matched default handler path /auth/forms/defaultForm.jsp
      [2017-07-03 03:21:24,269][XNIO-1 task-15] DEBUG security - Attempting to authenticate HttpServerExchange{ GET /auth/forms/defaultForm.jsp request

      {Accept=[text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8], Accept-Language=[en-US,en;q=0.8], Cache-Control=[max-age=0], Accept-Encoding=[gzip, deflate, br], User-Agent=[Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36], Connection=[keep-alive], Cookie=[autoIdmAppName=LoginTest; autoIdmSessionCookieName=tremolosession; tremolosession=eyJpdiI6IkExYXBIL1pOSTJLc01DbmtuL3VsNEFcdTAwM2RcdTAwM2QiLCJlbmNyeXB0ZWRSZXF1ZXN0IjoieDl5YTViN1o5RWxOdFIrNGt0eXU4L0hTdzlBNmpLbkN1QitKV3dnT1BaeXRJTERyamxENDM2VGl3TG1sSm5KRyJ9], Upgrade-Insecure-Requests=[1], Host=[localhost:8443]}

      response {}}, authentication required: false
      [2017-07-03 03:21:24,270][XNIO-1 task-15] DEBUG security - Authentication outcome was NOT_ATTEMPTED with method io.undertow.security.impl.CachedAuthenticatedSessionMechanism@4e5468dd for HttpServerExchange{ GET /auth/forms/defaultForm.jsp request

      {Accept=[text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8], Accept-Language=[en-US,en;q=0.8], Cache-Control=[max-age=0], Accept-Encoding=[gzip, deflate, br], User-Agent=[Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36], Connection=[keep-alive], Cookie=[autoIdmAppName=LoginTest; autoIdmSessionCookieName=tremolosession; tremolosession=eyJpdiI6IkExYXBIL1pOSTJLc01DbmtuL3VsNEFcdTAwM2RcdTAwM2QiLCJlbmNyeXB0ZWRSZXF1ZXN0IjoieDl5YTViN1o5RWxOdFIrNGt0eXU4L0hTdzlBNmpLbkN1QitKV3dnT1BaeXRJTERyamxENDM2VGl3TG1sSm5KRyJ9], Upgrade-Insecure-Requests=[1], Host=[localhost:8443]}

      response {}}
      [2017-07-03 03:21:24,271][XNIO-1 task-15] DEBUG security - Authentication result was ATTEMPTED for HttpServerExchange{ GET /auth/forms/defaultForm.jsp request

      {Accept=[text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8], Accept-Language=[en-US,en;q=0.8], Cache-Control=[max-age=0], Accept-Encoding=[gzip, deflate, br], User-Agent=[Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36], Connection=[keep-alive], Cookie=[autoIdmAppName=LoginTest; autoIdmSessionCookieName=tremolosession; tremolosession=eyJpdiI6IkExYXBIL1pOSTJLc01DbmtuL3VsNEFcdTAwM2RcdTAwM2QiLCJlbmNyeXB0ZWRSZXF1ZXN0IjoieDl5YTViN1o5RWxOdFIrNGt0eXU4L0hTdzlBNmpLbkN1QitKV3dnT1BaeXRJTERyamxENDM2VGl3TG1sSm5KRyJ9], Upgrade-Insecure-Requests=[1], Host=[localhost:8443]}

      response {}}
      [2017-07-03 03:21:24,274][XNIO-1 task-15] DEBUG servlet - JspEngine --> /auth/forms/defaultForm.jsp
      [2017-07-03 03:21:24,274][XNIO-1 task-15] DEBUG servlet - ServletPath: /auth/forms/defaultForm.jsp
      [2017-07-03 03:21:24,275][XNIO-1 task-15] DEBUG servlet - PathInfo: null
      [2017-07-03 03:21:24,276][XNIO-1 task-15] DEBUG servlet - RealPath: null
      [2017-07-03 03:21:24,277][XNIO-1 task-15] DEBUG servlet - RequestURI: /auth/forms/defaultForm.jsp
      [2017-07-03 03:21:24,277][XNIO-1 task-15] DEBUG servlet - QueryString: null
      [2017-07-03 03:21:27,866][ActiveMQ Journal Checkpoint Worker] DEBUG MessageDatabase - Checkpoint started.
      [2017-07-03 03:21:27,872][ActiveMQ Journal Checkpoint Worker] DEBUG MessageDatabase - Checkpoint done.
      [2017-07-03 03:21:32,920][ActiveMQ Journal Checkpoint Worker] DEBUG MessageDatabase - Checkpoint started.
      [2017-07-03 03:21:32,930][ActiveMQ Journal Checkpoint Worker] DEBUG MessageDatabase - Checkpoint done.
      [2017-07-03 03:21:37,020][ActiveMQ Broker[local] Scheduler] DEBUG Queue - queue://ActiveMQ.DLQ expiring messages ..
      [2017-07-03 03:21:37,020][ActiveMQ Broker[local] Scheduler] DEBUG Queue - queue://ActiveMQ.DLQ expiring messages done.
      [2017-07-03 03:21:37,021][ActiveMQ BrokerService[local] Task-2] DEBUG Queue - queue://ActiveMQ.DLQ, subscriptions=1, memory=0%, size=0, pending=0 toPageIn: 0, force:false, Inflight: 0, pagedInMessages.size 0, pagedInPendingDispatch.size 0, enqueueCount: 0, dequeueCount: 0, memUsage:0, maxPageSize:200
      [2017-07-03 03:21:37,926][ActiveMQ Journal Checkpoint Worker] DEBUG MessageDatabase - Checkpoint started.
      [2017-07-03 03:21:37,939][ActiveMQ Journal Checkpoint Worker] DEBUG MessageDatabase - Checkpoint done.}}

      The servlet I registered works great, but directly trying to load any files (doesn't matter if its a JSP or a PNG) fails with a 404

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              mlbiamts Marc Boorshtein (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: