CORS in CGI Scripts

Just output the line:

Access-Control-Allow-Origin: *

... as part of your CGI script's headers, for example, in Perl (using

print header(
  -type => 'text/turtle',
  -content_location => 'mydata.ttl',
  -access_control_allow_origin => '*',

For a more modern way of enabling CORS in Perl server scripts, see the Perl page.

or in Python:

print "Content-Type: text/turtle"
print "Content-Location: mydata.ttl"
print "Access-Control-Allow-Origin: *"

Who’s behind this

Monsur Hossain and Michael Hausenblas


The content on this site stays fresh thanks to help from users like you! If you have suggestions or would like to contribute, fork us on GitHub.

Buy the book

Save 39% on CORS in Action with promotional code hossainco at