GoodProxy is a lightweight proxy server built with Hono that facilitates fetching and transforming resources from remote servers. It handles various types of content including VTT files, HLS streams, and more, while providing enhanced CORS support and URL transformation capabilities.
- CORS Support: Allows cross-origin requests with customizable headers.
- Content Handling: Supports fetching and transforming VTT files, HLS streams, and more.
- Dynamic URL Replacement: Automatically updates URLs in fetched content to proxy paths.
To get started with GoodProxy, follow these steps:
-
Clone the Repository:
git clone https://github.com/yourusername/goodproxy.git cd goodproxy
-
Install Dependencies:
bun install
-
Start the Server:
bun run dev
The server will be available at
http://localhost:8787
.
- GET /: Returns a simple "Hello Hono!" message.
- GET /fetch: Proxy endpoint that fetches content from a remote server based on the
url
query parameter. Additonally, you can also pass referers usingref
parameter.
To fetch and transform content from a remote URL, you can make a request to /fetch
with a url
parameter:
curl "http://localhost:8787/fetch?url=https://example.com/resource?ref=https://some-referer.com"
Example:
const m3u8url = "https://vz-cea98c59-23c.b-cdn.net/c309129c-27b6-4e43-8254-62a15c77c5ee/842x480/video.m3u8";
const proxyUrl = "https://goodproxy.goodproxy.workers.dev";
const proxiedUrl = `${proxyUrl}/fetch?url=${m3u8url}`; // both encoded and non encoded urls will work
// https://goodproxy.goodproxy.workers.dev/fetch?url=https%3A%2F%2Fvz-cea98c59-23c.b-cdn.net%2Fc309129c-27b6-4e43-8254-62a15c77c5ee%2F842x480%2Fvideo.m3u8
// https://goodproxy.goodproxy.workers.dev/fetch?url=https://vz-cea98c59-23c.b-cdn.net/c309129c-27b6-4e43-8254-62a15c77c5ee/842x480/video.m3u8
GoodProxy includes the following CORS headers by default:
Access-Control-Allow-Origin
:*
Access-Control-Allow-Methods
:GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers
:Content-Type, Authorization
Access-Control-Max-Age
:3600
These can be modified as needed in the request.ts
file.
For development, you can use the following commands:
-
Run in Development Mode:
bun run dev
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request to contribute to GoodProxy.
For any questions or feedback, please contact your-email@example.com.