Gatsby: Serve socket.io.js with correct Content-Type header

Created on 8 Jun 2020  路  3Comments  路  Source: gatsbyjs/gatsby

Description

Having 2 issue's with socket.io crop up since 2.22.1 and later. Everything worked fine in 2.21.29

1) socket.io.js has no content-type which means when running with nosniff it can't be run
2) calls to socket.io are all coming over http instead of https

Both of these issue's are cropping up when serving the develop version over nginx reverse proxy with SSL done at the web server level.

Steps to reproduce

Ran a brand new site using gatsby new test-site; cd test-site; gatsby develop and encountered the same 2 problems.

Expected result

I would expect socket.io.js to provide a content type so when running under nosniff it can execute.
It would also be nice if socket.io calls went back to using relative instead of hardcoded url's so they can be accessed over https if the site itself is being served in https.

Environment

gatsby info --clipboard

System:
OS: Linux 5.5 Linux Mint 19.3 (Tricia)
CPU: (4) x64 Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz
Shell: 4.4.20 - /bin/bash
Binaries:
Node: 12.18.0 - /usr/bin/node
Yarn: 1.22.4 - /usr/bin/yarn
npm: 6.14.5 - /usr/bin/npm
Languages:
Python: 2.7.17 - /usr/bin/python
Browsers:
Firefox: 76.0
npmPackages:
gatsby: ^2.21.29 => 2.23.1
gatsby-awesome-pagination: ^0.3.5 => 0.3.6
gatsby-background-image: ^1.1.1 => 1.1.1
gatsby-cli: ^2.12.44 => 2.12.44
gatsby-image: ^2.4.3 => 2.4.6
gatsby-plugin-advanced-sitemap: ^1.5.4 => 1.5.5
gatsby-plugin-catch-links: ^2.3.1 => 2.3.4
gatsby-plugin-feed: ^2.5.1 => 2.5.4
gatsby-plugin-force-trailing-slashes: ^1.0.4 => 1.0.4
gatsby-plugin-ghost-images: ^1.1.1 => 1.1.4
gatsby-plugin-local-search: ^1.1.1 => 1.1.1
gatsby-plugin-manifest: ^2.4.9 => 2.4.10
gatsby-plugin-offline: ^3.2.1 => 3.2.8
gatsby-plugin-postcss: ^2.3.1 => 2.3.3
gatsby-plugin-react-helmet: ^3.3.1 => 3.3.3
gatsby-plugin-sharp: ^2.6.2 => 2.6.10
gatsby-plugin-styled-components: ^3.3.1 => 3.3.3
gatsby-source-filesystem: ^2.3.1 => 2.3.10
gatsby-source-ghost: ^4.0.4 => 4.0.5
gatsby-source-mysql: ^2.2.2 => 2.2.2
gatsby-transformer-sharp: ^2.5.2 => 2.5.4
npmGlobalPackages:
gatsby-cli: 2.12.44

Some screenshots of dev console showing differences:
Under 2.21.29
socket io-2 21 29
socket io-ssl-2 21 29

Under 2.23.1
mimetype-2 23 1
socket io-2 23 1
socket io-ssl-2 23 1

admin bug

Most helpful comment

Fix published in [email protected]

All 3 comments

This is a pretty big issue, since it makes it impossible to work with any video/ audio on mobile.

I solved the content-type issue in PR #26358, and have split out the HTTPS issue as #26359!

Fix published in [email protected]

Was this page helpful?
0 / 5 - 0 ratings