Frequently Asked Questions

How To Enable Cross Origin Resource Sharing (CORS)


I am getting connectivity errors when I try to stream with WebRTC from my website to my Red5 Pro instance.  When I try running it in Chrome, it throws an error similar to this:

XMLHttpRequest cannot load http://domain2.example. 
Origin http://domain1.example is not allowed by Access-Control-Allow-Origin


You need to add the CORS authorization header into your project.

In the {red5pro}/webapps/live/WEB-INF/web.xml, add the following (including the domain URL you are trying to access red5pro from):

       <param-value>GET, POST, PUT, DELETE, OPTIONS</param-value>

Please note: In all the following examples, the <domain name> should be the domain name that is assigned to your SSL certificate.


 header("Access-Control-Allow-Origin: <domain name>");

Ruby on Rails:

use Rack::Cors do
  allow do
    origins '<domain-name>'
    resource '<domain-name>', headers: :any, methods: :any

ExpressJS on NodeJS:

app.use(function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "<domain name>");
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");

app.get('/', function(req, res, next) {
  // Handle the get for this route
});'/', function(req, res, next) {
 // Handle the post for this route
Response.AppendHeader("Access-Control-Allow-Origin", "<domain name>");

For more information please see