The way the URL is expanded is as follows:
- You provide the base file in index.html, from where swagger.json is generated. The generated swagger.json file does not contain the per se URL or any http / https information. It has only the path to the base URL that you specified.
After creating the user interface based on the generated swagger.json, the Try buttons execute GET / POST / PUT requests based on the URL information in the address bar. check this piece of code in swagger-ui.js :
if (url && url.indexOf('http') !== 0) { url = this.buildUrl(window.location.href.toString(), url); }
So, if you want to use https, use https in the address bar to get to the Swagger interface. You will also need to mention the same in your index.html and in swagger-ui.js in the above code.
source share