This project is an Express.js-based proxy for the UPC Database API. The proxy serves as a middleman to handle custom headers, as the UPC Database API does not accept lowercase headers. Additionally, the proxy server is secured from unknown agents by requiring a PROXY_TOKEN, which is passed in the x-upcdp-authorization header.
- Custom Header Handling: Ensures compliance with UPC Database API's case sensitivity requirements for headers.
- Proxy Server Security: Only requests that include the correct
PROXY_TOKENin thex-upcdp-authorizationheader are processed, protecting the server from unauthorized access.
- Node.js and npm installed on your machine.
- An active account and API key from the UPC Database.
- A secure
PROXY_TOKENfor authentication to the proxy server.
-
Clone the repository:
git clone https://github.com/Helmare/upcdatabase-proxy.git cd upcdatabase-proxy -
Install dependencies:
npm install
-
Create an
.envfile with your proxy token:PROXY_TOKEN=your_secure_proxy_token_here
-
Run the proxy server:
npm start
To use the proxy, include the x-upcdp-authorization header with the correct PROXY_TOKEN when making requests. Only authorized requests will be forwarded to the UPC Database API.
curl -X GET http://localhost:3000/api/upc/{your-upc-code} \
-H "x-upcdp-authorization: your_secure_proxy_token_here"This request will be forwarded to the UPC Database API with the correct headers and processed if the provided token matches the one defined in the proxy.
Feel free to submit issues or pull requests. Contributions are welcome!
This project is licensed under the ISC License.