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
Worker thread queue size and timeout behavior
by Brad Wood
I'm looking for a bit of understanding on just how Undertow handles large
numbers of requests coming into a server. Specifically when more requests
are being sent in than are being completed. I've been doing some load
testing on a CFML app (Lucee Server) where I happen to have my io-threads
set to 4 and my worker-threads set to 150. I'm using a monitoring tool
(FusionReactor) that shows me the number of currently executing threads at
my app and under heavy load I see exact 150 running HTTP threads in my app
server, which makes sense since I have 150 worker threads. I'm assuming
here that I can't simultaneously process more requests than I have worker
threads (please correct if I'm off there)
So assuming I'm thinking that through correctly, what happens to additional
requests that are coming into the server at that point? I assume they are
being queued somewhere, but
- What is this queue?
- How do I monitor it?
- How big can it get?
- Where do I change the size?
- How long do things stay in there before sending back an error to the
HTTP client?
- Can I control what error comes back to the HTTP client in that
scenario?
- If I'm using an HTTP/S and AJP listener, do they all share the same
settings? Do they share the same queues?
I've done a bit of Googling and reviewed some docs but haven't quite found
any definitive information on this, and a lot of info I found was about
Wildfly specifically so I wasn't sure how much of it applied.
Thanks!
~Brad
*Developer Advocate*
*Ortus Solutions, Corp *
E-mail: brad(a)coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com
6 years, 9 months
LoadBalancingProxyClient URI mapping
by paroczizs .
Hi undertow Dev!
I would like to use the LoadBalancingProxyClient from a custom handler and
forward the request to a different server and different URI.
The server is set up this way:
LoadBalancingProxyClient lb = ..
lb.addHost(new URI("http://localhost:5001/other-app/service1"));
The handler is mapped like this
path = /my-server/serv-one
In the log I found this:
DEBUG [io.undertow.server.handlers.proxy] (default I/O-2) Sending request
ClientRequest{path='/other-app/service1/my-server/serv-one', method=GET,
protocol=HTTP/1.1} ..
Regards, Zsolt
6 years, 9 months
Wildfly 11 + ReverseProxy + 2 was ssl
by paroczizs .
Hi UndertowDev,
Is it possible to configure 2 way ssl with reverse proxy in wildfly
standalone.xml?
The schema and the realm set properly in case of 1 way ssl works fine
however when the back end requests for the client cert the wildfly does not
sent it:
22:12:41,187 INFO [stdout] (default task-2) *** CertificateRequest
...
22:12:41,213 INFO [stdout] (default task-2) Warning: no suitable
certificate found - continuing without client authentication
realm looks like this:
<security-realm name="PserverRealm">
<server-identities>
<ssl>
<keystore path="/home/config/pserver.jks"
keystore-password="123456" alias="pserver" key-password="123456"/>
</ssl>
</server-identities>
<authentication>
<truststore path="/home/config/pserver.jks"
keystore-password="123456"/>
</authentication>
</security-realm>
Another question whether is basic authentication possible from the
configuration?
Thank you in advance, Zsolt
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_camp...>
Mentes
a vírusoktól. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_camp...>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
6 years, 9 months
Serving files in a different hierarchy than the one in the file system
by Johannes Ernst
I’m attempting to serve a bunch of static files, which exist in the file system, but in various directories that do not correspond to the URL namespace. Example:
http://example.com/foo/one => /var/lib/one/bar
http://example.com/foo/two => /var/lib/two/bar
I have the mapping from incoming request URL to File to be served in a Map<String,File>. Now I’m attempting to hook up Undertow so it can serve those files according to my mapping, and I’m not entirely sure where to best plug this in without having to write loads of code.
As far as I can tell, I would need to implement my version of ResourceManager and Resource, sort of like File/PathResource/Manager, but there’s a lot of code there, not all of which I understand, and it would perhaps turn into a maintenance nightmare on my end.
I cannot see a straightforward way of overriding those classes either to “slide in” an alternate mapping.
Is there a better way of doing this?
Thanks,
Johannes.
6 years, 9 months
Path variables
by Fernando Cruz
Hi,
I define two template paths with the following implementation:
public class UndertowTwoPathVariablesApplication {
private static final Logger LOGGER = LoggerFactory.getLogger(UndertowTwoPathVariablesApplication.class);
public static void main(final String[] args) {
Undertow.builder()
.addHttpListener(8080, "localhost")
.setHandler(
Handlers.routing()
.get("/api/v1/orders/{orderId}/items/", (exchange) -> {
LOGGER.info("The path template defined is '/api/v1/orders/{orderId}/items/'");
LOGGER.info("The request URI '{}'", exchange.getRequestURI());
exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");
exchange.setStatusCode(StatusCodes.OK)
.getResponseSender().send("Retrieve all Items of the Order '"
+ exchange.getQueryParameters().get("orderId").getLast() + "'");
})
.get("/api/v1/orders/{orderId}/items/{itemId}", (exchange) -> {
LOGGER.info("The path template defined is '/api/v1/orders/{orderId}/items/{itemId}'");
LOGGER.info("The request URI '{}'", exchange.getRequestURI());
exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");
exchange.setStatusCode(StatusCodes.OK)
.getResponseSender().send(
"Retrieve the Item '" + exchange.getQueryParameters().get("itemId").getLast()
+ "' of the Order '" + exchange.getQueryParameters().get("orderId").getLast() + "'");
}))
.build()
.start();
}
}
And using the version 2.0.0.Beta1 of undertow-core I can not enter to the first Handler defined.
boggard@xiuhcoatl:~$ curl -v 'http://localhost:8080/api/v1/orders/12345/items'
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /api/v1/orders/12345/items HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Connection: keep-alive
< Content-Length: 0
< Date: Fri, 02 Feb 2018 08:08:48 GMT
<
* Connection #0 to host localhost left intact
boggard@xiuhcoatl:~$ curl -v 'http://localhost:8080/api/v1/orders/12345/items/'
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /api/v1/orders/12345/items/ HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Connection: keep-alive
< Content-Type: text/plain
< Content-Length: 41
< Date: Fri, 02 Feb 2018 08:09:15 GMT
<
* Connection #0 to host localhost left intact
Retrieve the Item '' of the Order '12345'
boggard@xiuhcoatl:~$ curl -v 'http://localhost:8080/api/v1/orders/12345/items/'
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /api/v1/orders/12345/items/ HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Connection: keep-alive
< Content-Type: text/plain
< Content-Length: 41
< Date: Fri, 02 Feb 2018 08:09:15 GMT
<
* Connection #0 to host localhost left intact
Retrieve the Item '' of the Order '12345'
This not happen when the path have just one path variable. I create the repo https://github.com/b0gg4rd/undertow-path-variable with the two implementations.
Best Regards
Fernando Cruz
6 years, 9 months