Skip to content

Instantly share code, notes, and snippets.

@rbranson
Created February 3, 2011 21:13
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save rbranson/810211 to your computer and use it in GitHub Desktop.
Save rbranson/810211 to your computer and use it in GitHub Desktop.
nginx Flash XML policy server
# Add this to your nginx.conf under http { }
server {
listen 843;
server_name localhost;
location / {
rewrite ^(.*)$ /crossdomain.xml;
}
error_page 400 /crossdomain.xml;
location = /crossdomain.xml {
root /var/www/crossdomain;
}
}
# In /var/www/crossdomain, create a crossdomain.xml file:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" secure="false" to-ports="*"/>
<site-control permitted-cross-domain-policies="master-only" />
</cross-domain-policy>
Copy link

ghost commented Jun 11, 2014

Last Nginx versions won't work. Explanation here:
http://forum.nginx.org/read.php?2,250772,250772#msg-250772

@EbertonMoraes
Copy link

Thaxll, have find a solution to the problem with nginx?

Copy link

ghost commented Jun 16, 2014

Not from Nginx, I think you need to write / use an app for that, It can be done quickly in many languages ;) Also you can create an Nginx module but I prefere the first solution.

@EbertonMoraes
Copy link

Thaxll, i'm a newbie and totally lost... hehe
Can help giving a one source? If you can, send me an email please eberton5@hotmail.com.

@darkwise
Copy link

As Thaxll said (forum nginx), last Nginx versions won't work (prior to 1.5.5), so I tried to implement a quick hack to serve the file content with a nginx custom server proxy coded in python.
You can find on my gist's fork nginx config and a python code that should be run as daemon (for ex. as a process on supervisord)

@Muqito
Copy link

Muqito commented Feb 16, 2015

OMG @darkwise, after nearly 30 hours of searching this was the answer to my question why my stupid crossdomain didn't work.

"last Nginx versions"

I ended up having a python script serving it instead.

Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment