You have to check if IIS and/or your redirect is properly adding the HTTP headers so that Forward middleware can interpret it correctly.
Alternatively you can try to use OnGetAbsoluteUrl
event: Swagger API service problem when using HTTPS URL - XData SwaggerUI - XDataServerModule - #16 by wlandgraf