Trouble with OpenApi when running behind a load balancer

I have a ServiceStack api hosted in AWS behind a private network load balancer exposed by an API Gateway. The api works fine, however, I cannot get to swagger when deployed to AWS. I can get to swagger when the container is running locally. For some reason the API Gateway url is being replaced by the nlb url when I make the request in AWS. It seems as though the forwarded url to the nlb is not being passed along to your OpenApi plugin and it’s using the nlb url itself. How can I fix this?

Do you have any Network Load Balancer (NLB) rules in place that might be causing the issue? When using the /swagger-ui a request also goes to /openapi for the service spec to populate the UI, could you share the responses you are getting when your application is deployed? Also any of your NLB rules if you could share, likewise with any other AWS related configuration, I might be able to help. Want to be able to confirm this is a hosting environment issue, thanks.

Currently only have one TCP listener set for 80 (the port exposed in the container). I am making a request to http://nlb/dev/swagger-ui which is returning a 302 response and redirecting to https://nlb/dev/swagger-ui.

I can get to /openapi just fine as well as an update.

Given there is both API Gateway and a Network Load Balance in between you and the server, I would need to be able to replicate your settings to try to help troubleshoot the issue.

If the NLB only has port 80 open I’m assuming that TLS is terminating somewhere else? Are you using a custom port for TLS? What is forwarding port 443 to port 80 on the container or responding for a redirect? Nothing in the default configuration for swagger that I can see forces a 302 or https upgrade.

Could you provide the full 302 request and response you are seeing?