relay_server/middlewares/
cors.rs1use std::time::Duration;
2
3use axum::http::{HeaderName, Method};
4use tower_http::cors::{Any, CorsLayer};
5
6pub fn cors() -> CorsLayer {
12 CorsLayer::new()
13 .allow_methods(Method::POST)
16 .allow_headers([
17 HeaderName::from_static("x-sentry-auth"),
18 HeaderName::from_static("x-requested-with"),
19 HeaderName::from_static("x-forwarded-for"),
20 HeaderName::from_static("origin"),
21 HeaderName::from_static("referer"),
22 HeaderName::from_static("accept"),
23 HeaderName::from_static("content-type"),
24 HeaderName::from_static("authentication"),
25 HeaderName::from_static("authorization"),
26 HeaderName::from_static("content-encoding"),
27 HeaderName::from_static("transfer-encoding"),
28 ])
29 .allow_origin(Any)
30 .expose_headers([
31 HeaderName::from_static("x-sentry-error"),
32 HeaderName::from_static("x-sentry-rate-limits"),
33 HeaderName::from_static("retry-after"),
34 ])
35 .max_age(Duration::from_secs(3600))
36}