Skip to content

Error: Mixed Content Type (related to Gatsby & HTTPS) #981

@maiya-22

Description

@maiya-22

Possible Bug

Hi, I came across an issue while deploying the Gatsby default starter with netlify-cli. I posted an issue on their repo, just in case. But it seems that it has to do with how netlify-cli is working.

ERROR:   polling-xhr.js:268 Mixed Content: The page at 'https://gatsby-site-name.netlify.live/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://gatsby-site-name-3e8071.netlify.live:61317/socket.io/?EIO=3&transport=polling&t=NCzNlEQ'. This request has been blocked; the content must be served over HTTPS.

Opened issue on Gatsby's GitHub:
gatsbyjs/gatsby#25695
(A user there suggested that it might be due to the sockets making requests that are not secure?)


BUG REPORT INFORMATION

Steps to reproduce:

  1. in terminal, run: gatsby new my-default-starter https://github.com/gatsbyjs/gatsby-starter-default
  2. remove .git folder
  3. re-init git and push it to gitHub
  4. netlify init
  5. go through the options to link the site to netlify
  6. build command: gatsby build
  7. deploy folder: public

Sometimes:

  1. Run "netlify dev --live"
  2. Copy paste the url that is generated in the terminal to the browser.
  3. Open the console, and see the Mixed Content Type Errors.

Other times:

  1. Add install the SaSS dependencies and add the plugin to the array of plugins in the gatsby-config.
  2. Run "git push origin master" to trigger automatic deploy to netlify.
  3. Allow time for site to build. There are no errors in the build log.
    (There was a message about a config file being missing, so they use defaults)
  4. Go to link of deployed site. See a 404 error in the window.
  5. See the logs of the Mixed Content erros in the consol.
  6. Expected result
  7. No errors, and content is reliably rendered.

Expected result:
No errors, and content is reliably rendered.

Actual result:
Sometimes there are errors, and sometimes not; and I'm not sure why.

Environment
System:
OS: macOS 10.15.4
CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.16.1 - /usr/local/bin/node
npm: 6.14.4 - /usr/local/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Chrome: 83.0.4103.116
Safari: 13.1
npmPackages:
gatsby: ^2.23.12 => 2.23.12
gatsby-image: ^2.4.9 => 2.4.9
gatsby-plugin-manifest: ^2.4.14 => 2.4.14
gatsby-plugin-offline: ^3.2.13 => 3.2.13
gatsby-plugin-react-helmet: ^3.3.6 => 3.3.6
gatsby-plugin-sass: ^2.3.12 => 2.3.12
gatsby-plugin-sharp: ^2.6.14 => 2.6.14
gatsby-source-filesystem: ^2.3.14 => 2.3.14
gatsby-transformer-sharp: ^2.5.7 => 2.5.7
npmGlobalPackages:
gatsby-cli: 2.12.44

netlify version --verbose

System:
OS: macOS 10.15.4
CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Binaries:
Node: 12.16.1 - /usr/local/bin/node
npm: 6.14.4 - /usr/local/bin/npm
Browsers:
Chrome: 83.0.4103.116
Safari: 13.1
npmGlobalPackages:
netlify-cli: 2.51.0

netlify-cli/2.51.0 darwin-x64 node-v12.16.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions