This is a simple CORS (Cross-Origin Resource Sharing) proxy server built with Express.js. It allows you to bypass CORS restrictions by proxying requests through this server.
- 🔓 Bypasses CORS restrictions
- 🛠 Built with Express.js
- 🔄 Uses
requestlibrary for proxying - 🌍 Allows requests from any origin
-
Clone this repository:
git clone https://github.com/skydope/cors-proxy.git -
Navigate to the project directory:
cd cors-proxy -
Install dependencies:
npm install
-
Start the server:
node server.js -
The server will start running on
http://localhost:3000.
Proxies a GET request to the specified URL.
Query Parameters:
url(required): The URL to proxy the request to.
Example:
http://localhost:3000/proxy?url=https://api.ipify.org/?format=json
- The server uses Express.js to create a web server.
- CORS middleware is added to allow requests from any origin.
- The
/proxyroute handles GET requests:- It extracts the
urlparameter from the query string. - If no URL is provided, it returns a 400 error.
- It uses the
requestlibrary to pipe the response from the specified URL back to the client.
- It extracts the
- This proxy allows requests from any origin. In a production environment, you may want to restrict this to specific origins.
- There's no validation on the URLs that can be accessed through this proxy. Consider implementing a whitelist of allowed domains for added security.
Contributions, issues, and feature requests are welcome! Feel free to check issues page.
This project is MIT licensed.
