Correctly shutting down a websocket handler
by Robin Anil
When a client disconnects, I see that onClose is not being fired. The only
way this seems to be firing if client sents a close frame.
Is there any way to detect disconnection and immediately close all the
opened resources.
Robin
Robin Anil | Software Engineer
1 year, 2 months
Session Cookie Domain?
by Hicks, Matt
I can't seem to figure out any way to configure the session manager to
define the domain of the cookie. I want the domain to be *.mydomain.com so
the cookie is shared across multiple sub-domains. Can someone give me an
example of how to do this?
Thanks
8 years, 2 months
Gzip and Proxy
by Martin Andersson
Hi all,
I've seem to have hit a bug in undertow when combining proxying and gzip.
I'm trying to use undertow as a reverse-proxy and also compressing the
result when clients support it. Undertow-code below.
* Proxying without compressing works fine (curl -v localhost:8099/proxy)
* Compressing content that is not proxied works fine (curl -v --compress
localhost:8099/local)
* Proxy and compression just hangs. Not even headers are received
(curl -v --compress
localhost:8099/proxy)
Trying to debug what's going on I found that the GzipStreamSinkConduit
receives all content but is never flushed.
The call sequence for GzipStreamSinkConduit for proxied content is:
write(ByteBuffer src) - all context from the proxied app is written.
wakeupWrites()
- which basically does nothing. Ends up in
DeflatingStreamSinkConduit.queueWriteListener() which calls any
WriteReadyHandlers but there are none.
Any clues?
My code to setup undertow:
final PathHandler pathHandler = Handlers.path();
pathHandler.addExactPath("/local", new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");
exchange.getResponseSender().send("Hello World"); }
});
pathHandler.addPrefixPath("/proxy",
new ProxyHandler(
new SimpleProxyClientProvider(new URI("http://localhost:8060/menu")),
ResponseCodeHandler.HANDLE_404));
final EncodingHandler handler =
new EncodingHandler(pathHandler, new ContentEncodingRepository()
.addEncodingHandler("gzip",
new GzipEncodingProvider(), 50,
Predicates.truePredicate()));
Undertow.builder()
.addHttpListener(8099, "0.0.0.0")
.setHandler(handler)
.build().start();
--
Br,
Martin Andersson
Purple Scout AB
+46 732 05 14 01
8 years, 2 months
UndertowClient Multipart
by Hicks, Matt
I'm attempting to use the UndertowClient to send multipart/form-data to a
server but I'm having trouble figuring out how to do so. I can't seem to
find any examples or documentation of how to accomplish this.
Any insights would be appreciated. I'm simply trying to encode a form POST
into multipart/form-data to send to a server and get the response back.
8 years, 3 months
How to configure Undertow programatically at runtime within Wildfly?
by Thomas Darimont
Hello list,
I'm currently working on embedding Keycloak's currently dedicated Proxy
Server into Keycloak itself.
For this I need to be able to dynamically configure Undertow's ProxyHandler
and register VirtualHosts at runtime.
For reference the discussion thread on keycloak-dev ML: [1]
Keycloak uses the Undertow Subsystem provided by Wildfly 10 which is
configured via the standalone(-ha).xml.
I could already configure a reverse-proxy and additional hosts via
jboss-cli but I wonder whether there is an API
that I could use to get access to the undertow infrastructure from within a
JAX-RS endpoint.
I could probably also use the wildfly management client API or perhaps do
something via JMX.
Would be great if someone could give me a tip or an example for registering
/ configuring Undertow Handler or Virtual Hosts as described above.
Btw. I saw that Undertow ships with a
io.undertow.server.handlers.proxy.HostTable but I couldn't find
any usage of it in the Undertow codebase - did I miss something or is this
dead code?
FYI current code of Keycloak dedicated Proxy Server (uses embedded
undertow) can be found here: [0]
Cherrs,
Thomas
[0] https://github.com/keycloak/keycloak/tree/master/proxy
[1] http://lists.jboss.org/pipermail/keycloak-dev/2016-August/007742.html
8 years, 3 months
Release of the undertow-pac4j security library version 1.2.0
by Jérôme LELEU
Hi,
I'm proud to announce the release of undertow-pac4j v1.2.0:
*https://github.com/pac4j/undertow-pac4j
<https://github.com/pac4j/undertow-pac4j>*
It supports most:
- authentication mechanisms: OAuth (Facebook, Twitter, Google, Yahoo...),
CAS, HTTP (form, basic auth...), OpenID, SAML, Google App Engine, OpenID
Connect, JWT, LDAP, RDBMS, MongoDB and Stormpath
- authorization checks: roles / permissions, CSRF, security headers...
It's based on Java 8, Undertow 1.3 and pac4j v1.9.1.
pac4j v1.9 is a big upgrade compared to v1.8:
- all dependencies have been upgraded, the source code has been cleaned
(-15%)
- multi-profiles are now supported
- the extension capabilities have been highly improved (core components can
now throw a HttpAction to break the flow and perform any specific
behaviour).
Check out the demo: *https://github.com/pac4j/undertow-pac4j-demo
<https://github.com/pac4j/undertow-pac4j-demo>*
Thanks.
Best regards,
Jérôme
8 years, 3 months
HTTP/2 initial exception
by Edgar Espina
Hi,
I'm playing with HTTP/2 and 1.4.0.Final and got a long stack trace on
first request, after first request no exception is generated or logged it.
You can reproduce this with a simple text response or with the HTTP/2
directory listing example.
Everything works as expected and exceptions are logged as debug not as
error... but I would like to know if this is expected or normal, as I said
everything works just got this ugly and log stack trace.
Thanks.
8 years, 3 months
StackOverflowError on AbstractFramedChannel
by electrotype
Hi,
Using Undertow 1.3.23.Final, I /sometimes/ get this error, when running my WebSocket tests :
------------------------------------------
2016-08-02 21:56:15 [ERROR] XNIO001007: A channel event listener threw an exception ~ Caller+0 at
org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:94)
java.lang.StackOverflowError: null
at
ch.qos.logback.classic.pattern.ThrowableProxyConverter.subjoinSTEPArray(ThrowableProxyConverter.java:197)
at
ch.qos.logback.classic.pattern.ThrowableProxyConverter.recursiveAppend(ThrowableProxyConverter.java:161)
at
ch.qos.logback.classic.pattern.ThrowableProxyConverter.throwableProxyToString(ThrowableProxyConverter.java:151)
at
ch.qos.logback.classic.pattern.ThrowableProxyConverter.convert(ThrowableProxyConverter.java:145)
at
ch.qos.logback.classic.pattern.ThrowableProxyConverter.convert(ThrowableProxyConverter.java:1)
at ch.qos.logback.core.pattern.FormattingConverter.write(FormattingConverter.java:36)
at
ch.qos.logback.core.pattern.PatternLayoutBase.writeLoopOnConverters(PatternLayoutBase.java:114)
at ch.qos.logback.classic.PatternLayout.doLayout(PatternLayout.java:141)
at ch.qos.logback.classic.PatternLayout.doLayout(PatternLayout.java:1)
at ch.qos.logback.core.encoder.LayoutWrappingEncoder.doEncode(LayoutWrappingEncoder.java:130)
at ch.qos.logback.core.OutputStreamAppender.writeOut(OutputStreamAppender.java:187)
at ch.qos.logback.core.OutputStreamAppender.subAppend(OutputStreamAppender.java:212)
at ch.qos.logback.core.OutputStreamAppender.append(OutputStreamAppender.java:100)
at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:84)
at
ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:48)
at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:270)
at ch.qos.logback.classic.Logger.callAppenders(Logger.java:257)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:421)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
at ch.qos.logback.classic.Logger.log(Logger.java:765)
at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.jboss.logging.Slf4jLocationAwareLogger.doLog(Slf4jLocationAwareLogger.java:89)
at org.jboss.logging.Slf4jLocationAwareLogger.doLogf(Slf4jLocationAwareLogger.java:82)
at org.jboss.logging.Logger.logf(Logger.java:2445)
at org.xnio._private.Messages_$logger.listenerException(Messages_$logger.java:923)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:94)
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener$2.run(AbstractFramedChannel.java:981)
at
io.undertow.server.protocol.framed.AbstractFramedChannel.runInIoThread(AbstractFramedChannel.java:235)
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:978)
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:937)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener$2.run(AbstractFramedChannel.java:981)
at
io.undertow.server.protocol.framed.AbstractFramedChannel.runInIoThread(AbstractFramedChannel.java:235)
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:978)
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:937)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener$2.run(AbstractFramedChannel.java:981)
at
io.undertow.server.protocol.framed.AbstractFramedChannel.runInIoThread(AbstractFramedChannel.java:235)
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:978)
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:937)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener$2.run(AbstractFramedChannel.java:981)
at
io.undertow.server.protocol.framed.AbstractFramedChannel.runInIoThread(AbstractFramedChannel.java:235)
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:978)
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:937)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener$2.run(AbstractFramedChannel.java:981)
at
io.undertow.server.protocol.framed.AbstractFramedChannel.runInIoThread(AbstractFramedChannel.java:235)
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:978)
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:937)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
...
------------------------------------------
The
------------------------------------------
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener$2.run(AbstractFramedChannel.java:981)
at
io.undertow.server.protocol.framed.AbstractFramedChannel.runInIoThread(AbstractFramedChannel.java:235)
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:978)
at
io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:937)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
------------------------------------------
part is repeated a lot of times before a stack overflow is reached.
I'm currently not able to reproduce the error on demand, most of the time it works just fine. I'm
still investigating.
I'd like to know if someone has already seen this? Any potential causes you may think of?
Thanks,
Julien
8 years, 3 months