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
HTTPS is ignored when basePath is relative (1.3.0) #337
Comments
Hi, swagger-ui should be using the base path as provided in the api declaration. Are you seeing otherwise? Verify your base path, similar to this: http://petstore.swagger.wordnik.com/api/api-docs/pet note the base path--that's what is used to make the requests. |
basePath is relative so swagger-ui should handle it as relative and use protocol and host from which is served, HTTPS in our case, but for some unknown reason swagger-ui use HTTP, always. e.g. basePath='/api' url='/docs/api-docs' url in browser = 'https://localhost/apidocs.jsp' and swagger-ui performs call on 'http://localhost/api/...' instead of 'https://localhost/api/...' |
Please post your resource listing & api declaration (take out anything sensitive) so I can see |
swagger ui declaration (published on https://localhost/api/apidocs.jsp) window.swaggerUi = new SwaggerUi({
url:"/api/api-docs",
dom_id:"swagger-ui-container",
basePath : "/api", resource listing (https://localhost/api/api-docs) {"apiVersion":"1.0.0","swaggerVersion":"1.2","apis":[{"path":"/metamodel","description":"the metamodel api"}]} metamodel listing (https://localhost/api/api-docs/metamodel) {"apiVersion":"1.0.0","swaggerVersion":"1.2","basePath":"/api","resourcePath":"/metamodel","apis":[{"path":"/metamodel/{metamodelId}","operations":[{"method":"GET","summary":"Returns metabodel by ID","notes":"","type":"MetamodelDto","nickname":"getMetamodel","produces":["application/json"],"parameters":[
... important is that swagger ui is published on HTTPS as well as api-docs (it works) and the api (it doesn't work because of protocol) e.g. when I perform GET /api/metamodel/123 in swagger-ui it calls http://localhost/api/metamodel/123 instead of https://localhost/api/metamodel/123 |
Hi, |
I can confirm that swagger-api/swagger-js#59 fixes this bug. |
If basePath (swagger.api.basepath) is relative (e.g. /api) and swagger-ui is served on HTTPS as well as api-docs and real api then swagger-ui always use HTTP instead of HTTPS.
Swagger-UI should handle relative basePath properly.
The text was updated successfully, but these errors were encountered: