Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Servers that supports CORS?

I wonder if there are many servers that are supporting CORS?

like image 646
ajsie Avatar asked Feb 10 '11 02:02

ajsie


2 Answers

To make your web server support CORS, it is as easy as making it return another header.

For example, in Apache2, simply add this line to your applicable conf file:

Header set Access-Control-Allow-Origin "*"

To be more secure (or if you don't have access to your server's conf file) you might want to NOT add this header in your server, but only add it with your server-side code when you really want it there.

For example in PHP you could do this: (untested)

<? header('Access-Control-Allow-Origin "*"'); ?>

like image 148
Magmatic Avatar answered Nov 03 '22 22:11

Magmatic


Tomcat users can use the CORS Filter

like image 44
Adam B Avatar answered Nov 03 '22 23:11

Adam B