Skip to content

Commit

Permalink
task: added etag middleware (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Kolstad authored Jan 27, 2023
1 parent 8f6fa05 commit b618ff1
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
55 changes: 53 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ homepage = "https://github.com/Unleash/unleash-edge"

[dependencies]
actix-cors = "0.6.4"
actix-middleware-etag = "0.1.1"
actix-tls = { version = "3.0.3", features = ["rustls"] }
actix-web = { version = "4.3.0", features = ["rustls"] }
actix-web-opentelemetry = { version = "0.13.0", features = ["metrics", "metrics-prometheus"] }

anyhow = "1.0.68"
chrono = { version = "0.4.23", features = ["serde"] }
clap = { version = "4.1.4", features = ["derive", "env"] }
Expand Down
2 changes: 2 additions & 0 deletions server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::sync::Arc;
use crate::cli::EdgeMode;
use crate::offline_provider::OfflineProvider;
use actix_cors::Cors;
use actix_middleware_etag::Etag;
use actix_web::{http, middleware, web, App, HttpServer};
use actix_web_opentelemetry::RequestTracing;
use clap::Parser;
Expand Down Expand Up @@ -45,6 +46,7 @@ async fn main() -> Result<(), anyhow::Error> {
.allowed_header(http::header::CONTENT_TYPE);
App::new()
.app_data(client_provider_data)
.wrap(Etag::default())
.wrap(cors_middleware)
.wrap(RequestTracing::new())
.wrap(request_metrics.clone())
Expand Down

0 comments on commit b618ff1

Please sign in to comment.