A Flash Policy Server in Ruby

This is a simple Ruby-based policy server to serve Flash's crossdomain.xml policy file.

Rationale

The web is increasingly realtime, but websockets still aren't supported on older browser clients. Many server push libraries (e.g. socket.io) attempt to use websockets, with a Flash fallback. Others (amqp.js, for instance) are Flash only.

When using Flash sockets, it's necessary to have a policy server running on port 843, in order to set cross domain policy. This library does the job.

Usage

Because Adobe was kind enough to pick a low port (843), the server needs to be run as root:

sudo flash_policy_server

If you don't yet have a crossdomain.xml in your current working directory, you'll be prompted to make one before the server can start. NB: the sample crossdomain.xml in the usage prompt is the most permissive possible policy.

You should read up on the uses of crossdomain.xml if you don't understand the security implications of this file. It's here:

www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html

Installation

gem install flash_policy_server

RVM gotcha!

Note: If you're using Ruby 1.9 and RVM, you'll need to run the server as:

rvmsudo flash_policy_server

See ruby.about.com/od/rubyversionmanager/qt/Rvm-And-Sudo.htm for an explanation.

Running in Docker

Don't like running stuff as root? Run it in a docker container. Customize the crossdomain.xml file if you need (in the /docker directory) and then rebuild;

cd docker
docker build -t="flash_policy_server" .

Then run it in the background;

docker run -d flash_policy_server

Contributing to flash-policy-server

Copyright © 2011-2018 Dave Hrycyszyn. See LICENSE.txt for further details.