Skip to content

Advanced HTTP/HTTPS proxy server in TypeScript, built on proxy-chain. Features configurable authentication, strict host validation, keep-alive connections, response compression, and advanced logging with Winston. Ideal for Discord bots, web scraping, and secure web traffic control.

License

Notifications You must be signed in to change notification settings

HCDevWorks/http-proxy

Repository files navigation

🧭 HTTP Proxy Server

English | Português

A robust and configurable HTTP proxy server developed in TypeScript, featuring authentication, host access control, and logging. Ideal for scenarios such as Discord bots, data scraping, and traffic control.

🚀 Features

  • 🔐 Basic authentication via config.toml
  • 🌐 Host access control
  • 📄 Logging with Winston
  • ⚙️ All configuration is loaded exclusively from config.toml
  • 🧪 Modular and extensible structure

Note:
All configuration is centralized in the config.toml file and loaded through the src/config/ module. No environment variables or other config files are used.

📦 Installation

  1. Clone the repository:

    git clone https://github.com/HCDevWorks/http-proxy.git
    cd http-proxy
  2. Install the dependencies:

    pnpm install
  3. Configure the config.toml file (see config.example.toml for an example):

    [server]
    port = 8888
    
    [logging]
    enableLogs = true
    enableErrorLogs = false
    
    [auth]
    username = "your_username"
    password = "your_password"
    
    [allowed_hosts]
    hosts = ["google.com", "youtube.com"]
    # Or to allow all hosts:
    # hosts = "*"

Note:
To allow connections from any host, set hosts = "*" in [allowed_hosts].
To restrict, use a list of domains, like hosts = ["google.com", "youtube.com"].

🛠️ Usage

Start the proxy server with:

pnpm build # build the server

pnpm start # start the server

The server will listen on the port defined in config.toml (default: 8888).

🖥️ Running as a Linux Service

See how to create a systemd service to run the proxy automatically on Linux in docs/LINUX-SERVICE.md.

📁 Project Structure

http-proxy/
├── src/
│   ├── config/
│   │   ├── index.ts      # Loads and exports the validated config object
│   │   ├── loader.ts     # Loads and parses config.toml, validates with Zod
│   │   └── schema.ts     # Zod schema and types for config
│   ├── core/
│   │   ├── logger.ts     # Winston logger configuration
│   │   └── server.ts     # Main proxy server logic
│   └── index.ts          # Entry point
├── tests/
│   ├── testProxy.ts
│   └── testProxyBenchmark.ts
├── config.toml
├── config.example.toml
├── logs/
│   └── proxy.log
├── package.json
├── pnpm-lock.yaml
├── tsconfig.json
└── docs/
    ├── LINUX-SERVICE.md
    └── pt-br/
        ├── LINUX-SERVICE.md
        └── README.md

🤝 Contributing

Contributions are welcome! Please read our Code of Conduct and Contributing Guidelines before opening issues or pull requests.

We also provide templates to help you:

📄 License

This project is licensed under the MIT License.

About

Advanced HTTP/HTTPS proxy server in TypeScript, built on proxy-chain. Features configurable authentication, strict host validation, keep-alive connections, response compression, and advanced logging with Winston. Ideal for Discord bots, web scraping, and secure web traffic control.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •