Self-Hosting
Corsfix is open source, meaning you can run it on your own infrastructure for complete control over your data.
Prerequisites
Section titled “Prerequisites”Before getting started, ensure you have:
- A VPS or dedicated server
- Docker and Docker Compose installed
- A domain name (optional, but recommended for production)
- Basic knowledge of Docker and command line operations
Installation Steps
Section titled “Installation Steps”1. Install Docker
Section titled “1. Install Docker”Install Docker on your machine by following the official installation guide:
- macOS: https://docs.docker.com/desktop/setup/install/mac-install/
- Windows: https://docs.docker.com/desktop/setup/install/windows-install/
- Linux: https://docs.docker.com/engine/install/
Verify Docker installation:
docker --versiondocker compose --version
2. Clone the Repository
Section titled “2. Clone the Repository”Clone the Corsfix repository to your server:
git clone https://github.com/corsfix/corsfix.gitcd corsfix
3. Configure Environment Variables
Section titled “3. Configure Environment Variables”Copy the example environment file and customize it:
cp .env.example .env
Edit the .env
file with your preferred text editor:
nano .env
Configure the following variables:
# Database credentialsMONGODB_USER=proxyMONGODB_PASSWORD=your_secure_mongodb_password
# Redis passwordREDIS_PASSWORD=your_secure_redis_password
# Generate these encryption keys using OpenSSLKEK_VERSION_1=your_32_char_base64_keyAUTH_SECRET=your_32_char_base64_key
# Your domain (use localhost for local development)DOMAIN=yourdomain.com
Generate secure encryption keys:
# Generate KEK_VERSION_1openssl rand -base64 32
# Generate AUTH_SECRETopenssl rand -base64 32
4. Start the Services
Section titled “4. Start the Services”Launch all Corsfix services using Docker Compose:
docker compose -f prod.yaml --env-file .env up -d
This command will:
- Pull the latest Corsfix images from GitHub Container Registry
- Start MongoDB, Redis, the dashboard app, proxy service, and Caddy reverse proxy
- Run all services in the background
Verify all services are running:
docker compose -f prod.yaml ps
5. Access the Dashboard
Section titled “5. Access the Dashboard”Once all services are up and running:
- Dashboard:
https://app.yourdomain.com
(orhttp://app.localhost
for local setup) - Proxy:
https://proxy.yourdomain.com
(orhttp://proxy.localhost
for local setup)
6. Create Your Account
Section titled “6. Create Your Account”- Navigate to the dashboard URL in your browser
- Create a new account using your email and a secure password
- Add your websites to the allowlist in the dashboard
7. Test the Proxy
Section titled “7. Test the Proxy”Test your CORS proxy by making a request through your proxy domain:
# Example using curlcurl -X GET "https://proxy.yourdomain.com/?https://api.example.com/data" \ -H "Origin: https://yourwebsite.com"
Or test in JavaScript:
fetch("https://proxy.yourdomain.com/?https://api.example.com/data") .then((response) => response.json()) .then((data) => console.log(data));
Managing Your Installation
Section titled “Managing Your Installation”View Logs
Section titled “View Logs”Monitor service logs:
# View all logsdocker compose -f prod.yaml logs -f
# View specific service logsdocker compose -f prod.yaml logs -f appdocker compose -f prod.yaml logs -f proxy
Update to Latest Version
Section titled “Update to Latest Version”Pull the latest images and restart services:
docker compose -f prod.yaml pulldocker compose -f prod.yaml --env-file .env up -d
Stop Services
Section titled “Stop Services”Stop all services:
docker compose -f prod.yaml down
Domain Configuration
Section titled “Domain Configuration”For production deployments with a custom domain:
-
Point your domain’s A records to your server’s IP address:
app.yourdomain.com
→ Your server IPproxy.yourdomain.com
→ Your server IP
-
Caddy will automatically handle SSL certificate generation via Let’s Encrypt
-
Update your
.env
file with your domain:Terminal window DOMAIN=yourdomain.com
Getting Help
Section titled “Getting Help”For additional support and community discussion, join our Discord server at: https://discord.gg/WEAeqrRjp2
Congratulations! You’ve successfully deployed Corsfix on your own infrastructure.