Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support https #171

Closed
canchanchara opened this issue Nov 20, 2019 · 1 comment · Fixed by thingsboard/thingsboard#10615
Closed

Support https #171

canchanchara opened this issue Nov 20, 2019 · 1 comment · Fixed by thingsboard/thingsboard#10615
Labels
invalid This doesn't seem right

Comments

@canchanchara
Copy link

I'm using springdoc with spring boot in a docker container.
The container is starting under port 8080.
The docker host is running an apache webserver with an reverse proxy to my docker image.

So I can browse to:

https://mywebsite.net/swagger-ui/index.html?url=/v3/api-docs

It shows the correct swagger UI.

The servers shows:

http://mywebsite.net - generated Server url.

It is intelligent, it shows the public domain with the right port, not the 'inside docker ip/port"

Can you fix it, that it is using https instead of http if I browse via https to the swagger documentation?

Otherwise the try it feature is not working. It is blocked to use a http rest api in a https website.

@springdoc
Copy link
Collaborator

Hi,

https is already supported.You have to review your spring-boot app / reverse proxy configuration.

In general, you should set the following headers in your reverse proxy configuration:

RequestHeader set X-Forwarded-Prefix "/custom-path"
RequestHeader set X-Forwarded-Proto https
RequestHeader set X-Forwarded-Port 443

Then, in your spring-boot application make sure your application handles this header: X-Forwarded-For. There are two ways to achieve this:

  • Since spring-boot 2.2, there is a new property to handle reverse proxy headers:
server.forward-headers-strategy=framework
  • Or you you can add the following Bean to your application:
@Bean
ForwardedHeaderFilter forwardedHeaderFilter() {
   return new ForwardedHeaderFilter();
} 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants