fix: gzip

This commit is contained in:
2025-11-26 18:24:54 +08:00
parent 300ee50390
commit 816ca009b9
5 changed files with 171 additions and 29 deletions

View File

@@ -1,10 +1,11 @@
use std::{net::SocketAddr, sync::Arc};
use anyhow::Context;
use axum::{routing::any, Router};
use axum::{Router, routing::any};
use dotenvy::dotenv;
use tower_http::compression::CompressionLayer;
use tracing::{error, info, level_filters::LevelFilter};
use tracing_subscriber::{fmt, prelude::*, EnvFilter};
use tracing_subscriber::{EnvFilter, fmt, prelude::*};
mod crypto;
mod proxy;
@@ -54,6 +55,8 @@ async fn main() -> anyhow::Result<()> {
// Create a reqwest client that ignores SSL certificate verification
let client = reqwest::Client::builder()
.gzip(true)
.deflate(true)
.danger_accept_invalid_certs(true)
.build()?;
@@ -68,6 +71,7 @@ async fn main() -> anyhow::Result<()> {
// Build our application with a single route
let app = Router::new()
.route("/{*path}", any(proxy::proxy_handler))
.layer(CompressionLayer::new().gzip(true))
.with_state(state);
// Run the server