'Swagger UI not working on websphere liberty with spring boot and https
Recently we migrated from websphere traditional to websphere liberty and since then we are not able to access swagger-ui from the browser.
We are using a spring boot app (2.5.12) on Websphere liberty (21.0.0.3) in linux. springfox-swagger-ui -3.0.0 is getting transitively added as part of the dependency chain. However when we try to access the swagger ui with https://hostname:9443/<>/swagger-ui/ , we are not getting the swagger ui . We just get a blank screen
On the console in the browser we get
GET https://hostname:9443/<<root>>/swagger-ui/swagger-ui.css?v=3.0.0 net::ERR_CONNECTION_CLOSED 200
GET https://hostname:9443/<<root>>/swagger-ui/swagger-ui-bundle.js?v=3.0.0 net::ERR_CONNECTION_CLOSED 200
GET https://hostname:9443/<<root>>/swagger-ui/swagger-ui-standalone-preset.js?v=3.0.0 net::ERR_CONNECTION_CLOSED 200
https://hostname:9443/<<root>>/swagger-ui/<<root>>/swagger-ui/springfox.js?v=3.0.0 net::ERR_CONNECTION_CLOSED 200
On the server logs in websphere we get the following
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:201)
at [internal classes]
at
Caused by: java.io.IOException: com.ibm.ws.http2.upgrade.H2Exception: stream was already closed!
... 88 more
Caused by: com.ibm.ws.http2.upgrade.H2Exception: stream was already closed!
... 88 more
The same set up is working locally in windows and in unix (with http) , so I am guess its either the https / websphere liberty configuration or something that is preventing the .css from getting downloaded.
- Has anyone got this to work ? Especially in a https environment.
- Any WebSphere liberty configuration / spring boot configuration that would help ?
- I know WebSphere liberty has its own UI for REST calls similar to swagger. Does it work with WebSphere liberty seamlessly. We are stuck with WebSphere so any specific server configuration is also appreciated.
- If not, is there any way in which we can get the css bundled as part of the app so it doesn't need to go back to fetch the css.
Any help is appreciated.
Thx
Solution 1:[1]
The way in which we fixed this issue is to migrate to springdoc. We have to remove swagger-ui references and then add spring doc and after doing this we were able to access in https.
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | user1540821 |