Excessive session creation

27 views
Skip to the first unread message

Peter Jacobs

unread,
24 Jun 2022, 06:25:0924/06/2022
to vert.x
I'm replacing an obsolete Jetty 9 + Shiro site with vertx 4.2.7.

All is well except every GET of a static resource is generating a new session.  Any ideas on how to avoid this please?  If necessary I can create a seperate server on a different port without a session handler, but I guess I'm simply missing something in the server config.

            Router router = Router.router(vertx);
            router.route()
                    .handler(SessionHandler.create(sessionStore))
                    .handler(FaviconHandler.create(vertx,
                            SitesManager2.getSitesPath().resolve("favicon.ico").toString()))
                    .handler(LoggerHandler.create(LoggerFormat.TINY))
                    .handler(bodyHandler).handler(basicAuthHandler)
                    .handler(this::maintenanceFilter)
                    .handler(this::clientAccessFilter2);
            // static routes (new session every time...)
            router.get("/static/*").handler(StaticHandler.create());
            // other routes (existing session honoured)
            ...

TIA

Nils Renaud

unread,
27 Jun 2022, 03:29:5027/06/2022
to vert.x
There is a solution for your issue: you can set the SessionHandler as Lazy.
SessionHandler.create(sessionStore).setLazySession(true)

Thomas SEGISMONT

unread,
28 Jun 2022, 05:11:2828/06/2022
to ve...@googlegroups.com
Thanks Nils for sharing the solution!


Would you mind contributing an update?

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/3bb63e72-b6af-4875-a7ea-b0b617a0e95bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages