Getting started Community Training Tutorials Documentation APIs, AI & Tools
use pdk::cors;
fn create_cors_configuration() -> cors:Configuration {
cors::Configuration::builder()
.public_resource(false)
.support_credentials(true)
.origin_groups(vec![cors::OriginGroup::builder()
.origin_group_name("default group".to_string())
.plain_origins(vec!["http://www.the-origin-of-time.com".to_string()])
.access_control_max_age(60)
.headers(vec![
"x-allow-origin".to_string(),
"x-yet-another-valid-header".to_string(),
])
.exposed_headers(vec!["x-forwarded-for".to_string()])
.allowed_methods(vec![
cors::AllowedMethod::builder()
.method_name("POST".to_string())
.allowed(true)
.build()
.unwrap(),
cors::AllowedMethod::builder()
.method_name("PUT".to_string())
.allowed(true)
.build()
.unwrap(),
])
.build()
.unwrap()])
.build()
.unwrap();
}



