Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vaadin blocks Swagger-UI

Iam trying to get swagger to work besides my Vaadin-Flow Application. Iam currently using Vaadin 22.0.4 with Spring-Boot 2.6.3 and springdoc-openapi-ui 1.6.5. The Swagger-ui should be available under http://localhost:8080/swagger-ui, but it is not:

enter image description here

I guess it gets blocked by vaadin in some way. Things like http://localhost:8080/v3/api-docs or Rest-Endpoints created by spring work fine.

Is there a way to allow a specific routes for swagger to work?

What i tried so far:

  1. Using spring security to allow swagger (extending WebSecurityConfigurerAdapter and overriting configure). There is a example of one try in the repository linked below.
  2. Using vaadin.urlMapping=/foo/* in the application.properties to change the root mapping from vaadin. That kinda works... Swagger is available under http://localhost:8080/swagger-ui and the Vaadin UI under http://localhost:8080/foo. I am just looking for the other way around. Vaadin should be available under http://localhost:8080/. But that shows that swagger would work.
  3. Using Swagger 2
  4. springdoc.swagger-ui.path

I also Uploaded a plain Vaadin project where the issue is reproducible: https://github.com/DerAzubi/swagger-test (to test the application just start the main function)

the last commit contains all changes made to the default vaadin starter.

like image 925
DerAzubi Avatar asked Nov 01 '25 17:11

DerAzubi


1 Answers

This is fixed in Vaadin 23.3.0 but not in a fully automatic way. You can define paths to exclude, e.g. vaadin.excludeUrls=/swagger-ui/** and those will not be handled by the Vaadin servlet when it is mapped to /*

like image 197
Tatu Lund Avatar answered Nov 04 '25 13:11

Tatu Lund