ruffle-rs / ruffle

A Flash Player emulator written in Rust
https://ruffle.rs
Other
15.67k stars 813 forks source link

Ruffle will not send referrer to `.swf` URL #14578

Open mokurin000 opened 10 months ago

mokurin000 commented 10 months ago

Describe the bug

This caused some sites refuses to load the correct swf while the embedded player not working, for example 4399.com

Expected behavior

Ruffle should load target swf with correct referrer

Content Location

https://www.4399.com/flash/161545_1.htm

Affected platform

Browser's extension

Operating system

Windows 11

Browser

Chrome

Additional information

image

"Error: please start game on our official site"

n0samu commented 10 months ago

The referrer URL is controlled by the browser, not Ruffle. Ruffle is also subject to CORS restrictions that prevent it from requesting SWF files from unrelated domains, unless those domains send the appropriate Access-Control-Allow-Origin header. 4399 would need to set up their servers to send this header if they want Ruffle to work; see our wiki.

mokurin000 commented 10 months ago

I found a workaround script for 4399 in an article, which will provide download for their swf file

wsxarcher commented 5 months ago

Sometimes the referer is also checked on downloaded SWF because it downloads other components. Now you can run most downloaded 4399 swf adding this to the CLI args --referer "https://www.4399.com" https://github.com/ruffle-rs/ruffle/pull/16424

riku-42 commented 3 months ago

I attempted to add a referer header to load 4399 games using the web/package/demo project, but I discovered that browsers do not permit direct modification of the referer header. However, browser extensions can modify the referer header by using the chrome.declarativeNetRequest API.