swagger-api / swagger-api/swagger-ui

swagger content is blocking on https server because of http

Open
#8,090 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

My code:

SWAGGER_URL = "/" + params["jobName"] + "/api/swagger-ui/"
API_URL = "/static/swagger.json"
SWAGGERUI_BLUEPRINT = get_swaggerui_blueprint(
    SWAGGER_URL, API_URL, config={"app_name": params["jobName"]}
)
app.register_blueprint(SWAGGERUI_BLUEPRINT, url_prefix=SWAGGER_URL)

Json file:

{
    "openapi": "3.0.0",
    "schemes": [
        "https",
        "http"
    ],
    "host": "{URL}",
    "basePath": "{URL}",
    "info": {
        "description": "{DESC}",
        "version": "1.0.0",
        "title": "{TITLE}",
        "license": {
            "name": "MIT",
            "url": "https://opensource.org/licenses/MIT"
        }
    },
    "servers": [
        {
            "url": "{SERVERURL}"
        }
    ],
    "tags": [
        {
            "name": "TEST",
            "description": "{TEST}"
        }
    ],
    "paths": {
        "/": {
            "get": {
                "tags": [
                    "UI load"
                ],
                "summary": "Returns User Interface",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            },
        },
    },
    "components": {}
}

this is working properly in my local system. but when i deploy it its loading http content instead of https which is blocking js and css file to load and screen getting is blank. console errors are as below.

Mixed Content: The page at 'https://{baseurl}/api/swagger-ui/' was loaded over HTTPS, but requested an insecure script 'http://{baseurl}/api/swagger-ui/swagger-ui-bundle.js'. This request has been blocked; the content must be served over HTTPS.

i am trying to load https content only but not able to do it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the get_swaggerui_blueprint configuration and the registered SWAGGERUI_BLUEPRINT at /api/swagger-ui/, then inspect how swagger-ui-bundle.js and CSS URLs are generated for an HTTPS deployment. Done means the Swagger UI page loads its JavaScript and CSS assets over HTTPS without mixed-content errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.