Code Monkey home page Code Monkey logo

cors-proxy's Introduction

CORS Proxy

This is a simple proxy server that adds the necessary headers to allow Cross-Origin Resource Sharing (CORS) for a specified website.

Getting Started

These instructions will help get a copy of the CORS-Proxy up and running on a local machine for development and testing purposes.

Prerequisites

Node.js and npm are required for the proxy to run. They can downloaded from the official website or can be installed with a package manager like Homebrew (for macOS) or Chocolatey (for Windows).

Installation

  1. Clone or download this repository.
  2. Open a terminal and navigate to the root directory of the project.
  3. Run npm install to install the required dependencies.

Running the Server

Run the following command to start the proxy server:

node index

The server will listen on port 3000 by default. To use a different port, pass the port as a parameter.

For example, to run the proxy server on port 3333, run the following command:

node index 3333

Usage

To use the proxy, simply make a request to localhost:<port>/proxy with the target URL as a header named 'Target-URL'. For example, to make a GET request to https://example.com/api/users, use the following URL:

http://localhost:3000/proxy/api/users

With the following header:

{ 'Target-URL': 'https://example.com' }

If using during development, a default URL can be set to avoid having to set the Target-URL header with every request.

For example, to set https://example.com/ as the default URL, pass the target URL as a parameter in the terminal:

node index 3000 https://example.com/

Note: if a Target-URL header is present in the request, it will override the default URL.

Limitations

  • The proxy only supports HTTP and HTTPS requests.
  • The proxy does not support websockets.
  • The proxy does not support server-side rendering of client-side applications.

Contributing

If you find a bug or have an idea for a new feature, please open an issue or submit a pull request.

cors-proxy's People

Contributors

jarvisar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.