From c0c80c0fdf6b334cccb5ca4fcc216ee44330b226 Mon Sep 17 00:00:00 2001 From: Geometrically <18202329+Geometrically@users.noreply.github.com> Date: Sat, 19 Feb 2022 17:51:24 -0700 Subject: [PATCH] See if RateLimit is cors issue (#303) --- src/main.rs | 54 ++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/main.rs b/src/main.rs index b66f59947..48c28b8fa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -246,33 +246,33 @@ async fn main() -> std::io::Result<()> { .max_age(3600) .send_wildcard(), ) - .wrap( - RateLimiter::new(MemoryStoreActor::from(store.clone()).start()) - .with_identifier(|req| { - let connection_info = req.connection_info(); - let ip = - String::from(if parse_var("CLOUDFLARE_INTEGRATION").unwrap_or(false) { - if let Some(header) = req.headers().get("CF-Connecting-IP") { - header.to_str().map_err(|_| ARError::IdentificationError)? - } else { - connection_info - .peer_addr() - .ok_or(ARError::IdentificationError)? - } - } else { - connection_info - .peer_addr() - .ok_or(ARError::IdentificationError)? - }); - - Ok(ip) - }) - .with_interval(std::time::Duration::from_secs(60)) - .with_max_requests(300) - .with_ignore_ips( - parse_strings_from_var("RATE_LIMIT_IGNORE_IPS").unwrap_or_default(), - ), - ) + // .wrap( + // RateLimiter::new(MemoryStoreActor::from(store.clone()).start()) + // .with_identifier(|req| { + // let connection_info = req.connection_info(); + // let ip = + // String::from(if parse_var("CLOUDFLARE_INTEGRATION").unwrap_or(false) { + // if let Some(header) = req.headers().get("CF-Connecting-IP") { + // header.to_str().map_err(|_| ARError::IdentificationError)? + // } else { + // connection_info + // .peer_addr() + // .ok_or(ARError::IdentificationError)? + // } + // } else { + // connection_info + // .peer_addr() + // .ok_or(ARError::IdentificationError)? + // }); + // + // Ok(ip) + // }) + // .with_interval(std::time::Duration::from_secs(60)) + // .with_max_requests(300) + // .with_ignore_ips( + // parse_strings_from_var("RATE_LIMIT_IGNORE_IPS").unwrap_or_default(), + // ), + // ) .app_data(web::Data::new(pool.clone())) .app_data(web::Data::new(file_host.clone())) .app_data(web::Data::new(indexing_queue.clone()))