-
Bug
-
Resolution: Done
-
Major
-
1.4.18.Final
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
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
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
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