-
-
Notifications
You must be signed in to change notification settings - Fork 832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web servers often serve WASM with incorrect MIME type; better docs/errors needed #400
Comments
The error happens because WASM files are not served with the proper MIME type of We should add this somewhere to the docs because it is a common problem, and possibly we could even have the JS detect this when trying to instantitiate the wasm and show a better error in-page. |
Thanks a lot for your answer. One last thing I would like to report about the Web build is that files that have already been played can look very messy when they are played another time (this may be a known issue). For example:
This seems related to files caching, as opening the Console > Network > Checking "Disable cache" prevent this issue to happen. Thanks again! |
I've added some text explaining what this issue is and how to fix it for Apache and NGINX over at the "Using Ruffle" page on the wiki. For other server software we should ask them to post here so we can amend the documentation going forwards. https://github.com/ruffle-rs/ruffle/wiki/Using-Ruffle |
Very helpful, thanks! |
Better error supplied in #1458. |
Hello, I want to use Ruffle on a hosted server that uses Litespeed. |
Thanks to Futurama for the response. I cannot access the hppd.conf file as it is a hosted server. I DID add a .htaccess file with the line "AddType application/wasm .wasm" in it, and put it on the same path as the .swf page, but it made no difference. I'll try moving the file to the root of the site and see if it helps. |
I added a line ("AddType application/wasm .wasm") to the existing .htaccess file in the root directory of the site. Tried accessing the Script page (which has the .swf on it) and refreshing the page. Same result. The actual error message from Ruffle is: "TypeError: Failed to execute 'compile' on 'WebAssembly': HTTP status code is not ok" It does not tell us what the http status code actually is... |
Further to my issue with the Litespeed server, I asked the hosting to add the wasm MIME to the mime.properties file, but was told they could only do on a VPN server. |
Thanks to Padre2 for suggestions. I added appropriate settings to .htaccess but it made no difference. I read Herschel's suggestion but it is over my head. If I understand him properly he is suggesting a different way for the WASM to build. It sounds like a good idea, hope it works... |
Use --target web in wasm-bindgen and file-loader for WASM files, allowing wasm-bindgen's built-in fallback from WebAssembly.instantiateStreaming to instantiate. file-loader spits out the WASM file directly in the output folder, and imports will resolve to the URL, so that we can load the file directly, avoiding webpack's built-in wasm loaders. This allows Ruffle to function on web servers even if they serve WASM files with the incorrect MIME type, fixing one of our biggest support requests (#400, #1458). There is some performance impact on loading with the fallback, but this is preferable to not working at all.
Use --target web in wasm-bindgen and file-loader for WASM files, allowing wasm-bindgen's built-in fallback from WebAssembly.instantiateStreaming to instantiate. file-loader spits out the WASM file directly in the output folder, and imports will resolve to the URL, so that we can load the file directly, avoiding webpack's built-in wasm loaders. This allows Ruffle to function on web servers even if they serve WASM files with the incorrect MIME type, fixing one of our biggest support requests (#400, #1458). There is some performance impact on loading with the fallback, but this is preferable to not working at all.
With today's nightly build, it should hopefully no longer be necessary for the file to be served with the correct MIME type. If you were having trouble before, please try with the newest build and let us know how it works. Then we can start adjusting the documentation to show that this is no longer necessary. (It's still beneficial to set the MIME type, if possible, but it's no longer required.) |
Thank you Herschel, that is good news. I can confirm that after installing the ruffle_nightly_2021_01_17_selfhosted files the MIME Type can be commented out., although I have left it in place after testing. I am now left with 2 SWF files which display, but the animation does not run. One is an analogue clock for unknown reasons (how to check?) and the other a digital clock which has ActionScript 3 content. |
Hi Mike and thanks for the response.
I installed the 17th build of Ruffle on the server, replacing the previous 11th.
I then decided to change the actual page to use the example given on the Wiki for dynamically instancing the player (here’s the code):
<script>
window.RufflePlayer = window.RufflePlayer || {};
window.addEventListener("load", (event) => {
const ruffle = window.RufflePlayer.newest();
const player = ruffle.createPlayer();
const container = document.getElementById("container");
container.appendChild(player);
player.load("images/quill1.swf");
});
</script>
<script src="ruffle/ruffle.js"></script>
Unfortunately, it still crashes, but there is a different error message:
And here’s the rest of the scrolled window:
I hope this is helpful…
Cheers,
Pete.
From: Mike Welsh <notifications@github.com>
Sent: Sunday, 17 January 2021 14:51
To: ruffle-rs/ruffle <ruffle@noreply.github.com>
Cc: MoreporkGithub <dashwood@EOL.co.nz>; Comment <comment@noreply.github.com>
Subject: Re: [ruffle-rs/ruffle] Web servers often serve WASM with incorrect MIME type; better docs/errors needed (#400)
With today's nightly build, it should hopefully no longer be necessary for the server to have the correct MIME type. If you were having trouble before, please try with the newest build and let us know how it works. Then we can start removing the MIME type stuff from the FAQs.
(It's still beneficial to set the MIME type, if possible, but it's no longer required.)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#400 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ASNPV4ZLCNB3PI3K5P7I3T3S2I67RANCNFSM4KYLSZ7A> . <https://github.com/notifications/beacon/ASNPV4ZLL6AAM65NXJLASB3S2I67RA5CNFSM4KYLSZ7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFVTNIIQ.gif>
|
Guys, I'm sorry. I replied by direct email and didn't intend for this to be published. I can't find any way to edit or delete it. The embedded images don't seem to have appeared anyway so it it is pretty pointless. I won't make the mistake again. sorry. |
The new error message I get from the release of the 17th is: Error InfoError name: CompileError
Player InfoAllows script access: true Page InfoPage URL: https://primacomputing.co.nz/PRIMAMetro/Scripting.aspx Browser InfoUseragent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36 Edg/87.0.664.75 Ruffle InfoVersion: 0.1.0 Hope this helps. |
@MoreporkGithub It looks like the WASM file is missing and is getting a 404: |
Not sure specifically what the problem is, but this file is still not accessible: |
As far as I know everything in that directory is accessible, but I'll check it out. If I can't find a problem I may need to talk to the ISP who is hosting it. That could take a day or so. Will get back to you in either case. Many thanks. |
Thanks SO much to Herschel. I spoke with the ISP who confirmed that the problem is simply the MIME Type not being known to the server. He said it is a Windows server (which I had forgotten about) so the .htaccess file didn't work for it. I needed to go to HELM (the server manager) and set the MIME type for wasm there. Once I did that, it worked perfectly :-) I'd like to say how impressed I am with the Ruffle tool and the fact that there were people prepared to help with an Open Source tool. Sincere and deep thanks for your help. |
Glad it got sorted out, and thanks for posting your solution as it may be useful to others with the same server :-) |
Further to postings above where there were issues with MIME on Linux/Apache/Litespeed servers. This was initially solved by adding the .wasm MIME to the .htaccess file and the with the ruffle_nightly_2021_01_17_selfhosted file was able to have Flash working without the MIME in .htaccess. Now have found a similar issue errors on a Windows server, Here .htaccess cannot be used but the following solved the problem:
|
Thanks for this, Padre2. As noted in the thread above, I was able to solve this with help from Herschel and my ISP. But this is a simple and universal solution for Windows and I'm sure many people will find it useful. |
Anyone know anything on how to enable .wasm files on GH-pages? I haven't gotten ruffle working on it, and i suspect it being the .wasm issue. I haven't found anything to help with it, All the webpage does is download the .swf file (note this may be because I'm using Iframes) unless you have the extension turned on (Which then it will play the game fine). If it's another problem please tell me! -Discoveryx64 |
Can you explain what you mean by "unless you have the extension turned on"? Which extension? |
I meant the ruffle extension, my bad! I'm bad at clarifying things while speaking/typing (I usually have to clarify afterwards) 😅 |
Hello,
I get an error when using a Web build on my site. Here is what is logged in the console in Firefox (Windows):
Chrome (Windows) is a bit more explicit:
It turns out the server interpreted the .wasm file as being of type "octet-stream". However, testing the build locally with WampServer has not solved the issue, despite the correct mime type being returned.
There is no issue on iPad (iPadOS 13 - Safari and Chrome), Ruffle runs as expected.
Thanks.
UPDATE:
Actually Apache needed an extra line in the .htaccess (even in the local server):
... and clearing browser's cache after this.
The text was updated successfully, but these errors were encountered: