DEXPRO-Solutions-GmbH / swaggerui

Gin handler to expose an OpenAPI spec via Swagger UI
Apache License 2.0
0 stars 0 forks source link

WithAddServerUrls Option with protocol parameter #2

Open fabiante opened 1 year ago

fabiante commented 1 year ago

WithAddServerUrls implicitly adds two server urls, one for http, one for https.

https://github.com/DEXPRO-Solutions-GmbH/swaggerui/blob/0f4af9b0b2c4caa451328079be9d3602d1a50f62/handler.go#L68

In Summary, let's change the method signature to:

func WithDynamicServerUrl(secure bool) Option

I think the new name states more clearly what this function does.

fabiante commented 1 year ago

I am unsure about how the parameter should work and if we want to call WithDynamicServerUrl twice then, once for HTTP, once for HTTP.

There may also be the option to support proxies which often include the original protocol as header. This would allow to correctly determine the protocol even if the application is behind a reverse proxy which terminates SSL and forwards without SSL.