The purpose of this project is to create an HTTP proxy server to normalize requests with CORS and facilitate API interactions with any request method and on-the-fly modifications.
Project Benefits
This project simplifies the development process by handling CORS issues and providing a flexible way to interact with APIs, making it easier to test and develop applications.
How the Project Works
The project sets up a proxy server using Node.js that intercepts HTTP requests, adds the necessary CORS headers, and allows for modification of the request and response on the fly.
Repository and Installation
To install and run the project:
-
Clone the repository:
-
Install dependencies and start the server:
How to use?
Make default requests to /
path and set header cors-url
with site url
For ignore headers set header cors-ignore
with array of headers will be deleted from request
all methods, headers, params duplicated automatically
How change port?
- Create file
.env
- write
PORT=<Your port>
- Save changes
How change enterpoint?
Change or add to file
.env
next lineENTERPOINT=/
How change alowed methods?
Change or add to file
.env
next lineALOWED=GET, POST, PUT, DELETE
Project Workflow
-
Setup Project: Initialize the project structure and dependencies.
-
Create Proxy Server: Set up the proxy server with CORS handling.
Skills Gained
- Developing proxy servers with Node.js
- Handling CORS issues in web development
- Modifying HTTP requests and responses on the fly