This is a simple CORS proxy built with Rust and Warp. It allows you to forward requests to a specified URL while handling CORS headers.
- Handles GET requests and proxies them to the specified target URL.
- Supports adding
Referer
andOrigin
headers. - Optionally proxies all URLs in
.m3u8
playlists.
- Rust (latest stable version)
- Cargo (comes with Rust)
-
Clone the repository:
git clone https://github.com/devaoto/rust-m3u8-proxy.git cd rust-m3u8-proxy
-
Build the project:
cargo build --release
-
Run the application:
cargo run --release
The server will start on
http://127.0.0.1:3030
.
Make a GET request to the /proxy
endpoint with the following query parameters:
url
: The target URL to fetch.referer
: (Optional) The Referer header value.origin
: (Optional) The Origin header value.all
: (Optional) Set toyes
to proxy all HTTP links in.m3u8
playlists.
Example:
curl "http://127.0.0.1:3030/proxy?url=https://example.com/stream.m3u8&referer=https://yourreferer.com&origin=https://yourorigin.com&all=yes"
You can host this application using services like:
- Railway: railway.app (Paid)
- Render: render.com (Free)
- Heroku: heroku.com (Half-paid, CC required)
You can run this application in a Docker container. See the Dockerfile
section below for instructions.
Feel free to open issues or submit pull requests to enhance the functionality of this CORS proxy.
This project is licensed under the MIT License - see the LICENSE file for details.
# Use the official Rust image as the base image
FROM rust:latest AS builder
# Set the working directory
WORKDIR /usr/src/app
# Copy the source code
COPY . .
# Build the application
RUN cargo build --release
# Use a minimal base image for the final image
FROM debian:buster-slim
# Copy the compiled binary from the builder stage
COPY --from=builder /usr/src/app/target/release/rust-m3u8-proxy /usr/local/bin/rust-m3u8-proxy
# Expose the port
EXPOSE 3030
# Run the application
CMD ["rust-m3u8-proxy"]
-
Build the Docker image:
docker build -t rust-m3u8-proxy .
-
Run the Docker container:
docker run -p 3030:3030 rust-m3u8-proxy
Your application should now be accessible at http://localhost:3030
.
This project was inspired by Chance's Cloudflare Worker M3U8 Proxy URL: https://github.com/Gratenes/m3u8CloudflareWorkerProxy