wrap both regular endpoint and TTN endpoint in CORS checks
@@ -133,12 +133,15 @@ pub async fn run(config: Config, startup: &mut dyn Startup) -> anyhow::Result<()
.app_data(web::Data::new(http_server_commands.clone()))
.app_data(web::Data::new(device_authenticator.clone()))
.service(web::resource("/").route(web::get().to(index)))
+ .service(
+ web::scope("")
+ .wrap(cors)
// the standard endpoint
.service(
web::scope("/v1")
- .wrap(cors)
.service(
- web::resource("/{channel}").route(web::post().to(telemetry::publish_plain)),
+ web::resource("/{channel}")
+ .route(web::post().to(telemetry::publish_plain)),
)
.service(
web::resource("/{channel}/{suffix:.*}")
@@ -151,6 +154,7 @@ pub async fn run(config: Config, startup: &mut dyn Startup) -> anyhow::Result<()
.route("/", web::post().to(ttn::publish_v2))
.route("/v2", web::post().to(ttn::publish_v2))
.route("/v3", web::post().to(ttn::publish_v3)),
+ ),
);
})
.tls_auth_config(tls_auth_config)
