Servers that supports CORS?
Asked Answered
E

4

5

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

Era answered 10/2, 2011 at 2:39 Comment(1)
Can you clarify what you mean with "servers"? Do you mean specific implementations of CORS, or do you mean server software (such as Apache) that can be configured for CORS? For the former, Wikipedia has a list of web services that support CORS: en.wikipedia.org/wiki/…Bayles
P
8

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 "*"'); ?>

Pantalets answered 7/4, 2011 at 17:18 Comment(1)
There is a useful W3C page here on CORS support/installation on web servers.Monoplane
S
2

Tomcat users can use the CORS Filter

Shenyang answered 21/7, 2011 at 22:8 Comment(0)
C
0

You can find here a simple implementation of a Python 2.7 server supporting CORS

Convene answered 7/2, 2015 at 11:59 Comment(0)
L
0

use this code to run your cors proxy server just by

  • creating a file "proxy.js" and add below code

  • and run node proxy.js

let host = process.env.HOST || "0.0.0.0";
let port = process.env.PORT || 8000;
let cors_proxy = require("cors-anywhere");
cors_proxy
  .createServer({
    originWhitelist: [],
    requireHeaders: ["origin", "x-requested-with"],
    removeHeaders: ["cookie", "cookie2"],
  })
  .listen(port, host, () => {
    console.log("Cors Proxy running on 8000...");
  });

after starting this server you can use it like http://localhost:8000/https://example.com

Lynnettelynnworth answered 2/7 at 20:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.