ajsie
ajsie

Reputation: 79796

Servers that supports CORS?

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

Upvotes: 5

Views: 3937

Answers (4)

Twinkle Jaiswal
Twinkle Jaiswal

Reputation: 1

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

Upvotes: 0

Bastien
Bastien

Reputation: 1011

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

Upvotes: 0

Adam B
Adam B

Reputation: 1774

Tomcat users can use the CORS Filter

Upvotes: 2

Magmatic
Magmatic

Reputation: 1949

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

Upvotes: 8

Related Questions