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.
- π 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 theconfig.toml
file and loaded through thesrc/config/
module. No environment variables or other config files are used.
-
Clone the repository:
git clone https://github.com/HCDevWorks/http-proxy.git cd http-proxy
-
Install the dependencies:
pnpm install
-
Configure the
config.toml
file (seeconfig.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, sethosts = "*"
in[allowed_hosts]
.
To restrict, use a list of domains, likehosts = ["google.com", "youtube.com"]
.
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).
See how to create a systemd service to run the proxy automatically on Linux in docs/LINUX-SERVICE.md
.
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
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:
This project is licensed under the MIT License.