https://github.com/obeone/simple-cors-proxy
Simple CORS proxy server for seamless cross-origin requests with TypingMind plugin. Easy setup.
https://github.com/obeone/simple-cors-proxy
cors cors-proxy cors-proxy-server plugin typingmind
Last synced: 5 months ago
JSON representation
Simple CORS proxy server for seamless cross-origin requests with TypingMind plugin. Easy setup.
- Host: GitHub
- URL: https://github.com/obeone/simple-cors-proxy
- Owner: obeone
- Created: 2024-01-05T03:40:31.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-07T05:21:55.000Z (over 1 year ago)
- Last Synced: 2025-01-07T06:18:28.412Z (over 1 year ago)
- Topics: cors, cors-proxy, cors-proxy-server, plugin, typingmind
- Language: JavaScript
- Homepage:
- Size: 66.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🐳 Docker Simple CORS Proxy
🐳 [Docker Image](https://hub.docker.com/r/obeoneorg/simple-cors-proxy) | 🔗 [TypingMind Plugin](https://cloud.typingmind.com/plugins/p-01HMARRCP06S0B7Y6HRX1F9R0P)
This is a simple CORS proxy server designed to work with the TypingMind plugin. It allows you to make cross-origin requests to any API without worrying about CORS restrictions.
But it's not limited to TypingMind. You can use it with any application that requires a CORS proxy!
## 🚀 Features
- 🌐 Seamless integration with external APIs using the TypingMind plugin
- 🔒 Secure authentication using an API key
- 🔗 Ability to proxy requests to any URL using the `X-Url-Destination` header or directly in the URL path
- 🔄 Handles CORS headers to enable cross-origin requests
- ⚙️ Easy setup and configuration
- 🐳 Docker image available for quick deployment
## ⌨️ TypingMind Plugin
The TypingMind plugin is a powerful tool that enhances the capabilities of GPT. With the TypingMind plugin, GPT can seamlessly make calls to any API without being restricted by CORS (Cross-Origin Resource Sharing) policies. This allows GPT to access external data sources and services, opening up a wide range of possibilities for integration and interaction.
To use the TypingMind plugin, simply install go to the [TypingMind Plugin page](https://cloud.typingmind.com/plugins/p-01HMARRCP06S0B7Y6HRX1F9R0P) and click on Import.
## 🐳 Docker
You can use the Docker image to quickly run the proxy server. Here's how:
1. Pull the Docker image:
```shell
docker pull obeoneorg/simple-cors-proxy
```
2. Run the Docker container:
```shell
docker run -d --name simple-cors-proxy -p 8080:8080 obeoneorg/simple-cors-proxy
```
## 🐳 Docker Compose
You can use the Docker Compose file to quickly run the proxy server. Here's how:
1. Run the Docker Compose file:
```shell
docker compose up -d
```
## 💻 Manual Installation
To use this proxy server without Docker, follow these steps:
1. Clone the repository:
```shell
git clone https://github.com/obeone/simple-cors-proxy.git
```
2. Install the dependencies:
```shell
npm install
```
3. Start the server:
```shell
npm start
```
4. The server will be running on port 8080 by default. You can change the port by setting the `PORT` environment variable.
## 📝 Usage
### Basic Usage
To use the proxy server, you need to send a request with the `X-Url-Destination` header set to the URL of the resource you want to access.
Example:
```shell
curl -H "X-Url-Destination: http://example.com" http://localhost:8080/proxy
```
### Advanced Usage
#### Passing URLs Directly
You can now pass the entire URL directly after `/proxy/` in your request. This method preserves any query parameters that might be present in the URL.
Example:
```shell
curl http://localhost:8080/proxy/https://example.com/some/path?foo=1
```
By using this approach, the server automatically sets the `X-Url-Destination` header to the full decoded URL, making it easier and more intuitive to use the proxy.
#### Authentication
If you need to authenticate access to the proxy server, you can use the `PROXY_TOKEN` environment variable. You set the `PROXY_TOKEN` environment variable to the value of your API key, and the proxy server will check the API key in the `X-Proxy-Token` header.
Example :
```shell
docker run -d --name simple-cors-proxy -p 8080:8080 -e PROXY_TOKEN=YOUR_API_KEY obeoneorg/simple-cors-proxy
```
```shell
curl -H "X-Proxy-Token: YOUR_API_KEY" -H "X-Url-Destination: http://example.com" http://localhost:8080/proxy
```
#### Headers Removal
If you need to remove some headers (for example `X-Forwarded-For`), you can use the `x-headers-delete` header. For example, if you want to remove the `X-Forwarded-For` header, you can set the `x-headers-delete` header to `X-Forwarded-For`.
You can also use the environment variable `HEADERS_TO_DELETE` to remove specific headers, or both.
In both cases, if you need to remove multiple headers, you can use a comma-separated list.
So for example :
```shell
docker run -d --name simple-cors-proxy -p 8080:8080 -e HEADERS_TO_DELETE=X-Forwarded-For,X-Forwarded-Host obeoneorg/simple-cors-proxy
```
## 🤝 Contributing
Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request on [GitHub](https://github.com/obeone/simple-cors-proxy).
_Generated by GPT-3.5-turbo-1106_