Search code examples
httpnginxhttpsmixed-content

How to display HTTP content in HTTPS webpage


I have NGINX running in my server (HTTPS), and I have, also running in the server an API (via PM2). This API response is HTTP, and I want to display the responses in the HTTPS webpage.

I can't run the PM2 API in HTTPS. What I want is to allow HTTPS to serve HTTP content.

Mixed Content: The page at 'https://example_web.com' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://example_api.com'. This request has been blocked; the content must be served over HTTPS.

Solution

    1. We can't fetch HTTP resources from HTTPS origin.
    2. Most browsers block it for security reasons.
    3. We can proxy the answer of the web service through your sever.