anonymous_github
anonymous_github copied to clipboard
Anonymous Github not returning Content-Type header for Github pages (issue for ES6 modules in HTML spec)
Github pages that use module scripts like below:
<script type="module" src="./somefile.js"></script>
will not work on anonymous.4open.science. The reason for this is that no
MIME type is reported for somefile.js
which is required by the HTML5 specification.
To get modules to work correctly in a browser, you need to make sure that your server is serving them with a Content-Type header that contains a JavaScript MIME type such as text/javascript. If you don't, you'll get a strict MIME type checking error along the lines of "The server responded with a non-JavaScript MIME type" and the browser won't run your JavaScript.
It should not be too difficult to handle. I will have a look in the future if you want to handle it. PRs are welcome. It should be added here: https://github.com/tdurieux/anonymous_github/blob/7c326143f5a2137ce73efff996d075527b878422/src/AnonymizedFile.ts#L193
I don't succeed to reproduce it, the content type is correctly sent in the cases that I tested. Could you send me an example?