Skip to content

oauth2 redirect url calculated incorrectly when springdoc.swagger-ui.path=/ #1035

Closed
@philsttr

Description

@philsttr

Describe the bug
When springdoc.swagger-ui.path=/, the oauth2 redirect url is incorrectly calculated as http:/webjars/swagger-ui/oauth2-redirect.html

To Reproduce

spring boot 2.4.2
springdoc-openapi-webflux-ui 1.5.2

Configure springdoc.swagger-ui.path=/

Start application

Hit http://host:port/ first. (it is important that this url is hit first, before any other urls, for the bug to reproduce)

Then hit http://host:port/v3/api-docs/swagger-config

Notice "oauth2RedirectUrl": "http:/webjars/swagger-ui/oauth2-redirect.html",

Expected behavior

I expect oauth2RedirectUrl to be http://host:port/webjars/swagger-ui/oauth2-redirect.html",

Additional context

I believe the problem is here:

In this case, request.getPath().toString == '/', so "http:host:port" is assigned to the url variable, which screws up the downstream logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions