mirror of
https://github.com/mastodon/flodgatt
synced 2025-04-11 22:58:25 +02:00
Add CORS support
Cross-Origin requests were already implicitly allowed, but this commit allows them explicitly and prohibits request methods other than GET.
This commit is contained in:
parent
1765dc39ee
commit
f3b86ddac8
@ -171,5 +171,9 @@ fn main() {
|
||||
.unwrap_or("127.0.0.1:4000".to_owned())
|
||||
.parse()
|
||||
.expect("static string");
|
||||
warp::serve(websocket.or(routes)).run(address);
|
||||
let cors = warp::cors()
|
||||
.allow_any_origin()
|
||||
.allow_methods(vec!["GET", "OPTIONS"])
|
||||
.allow_headers(vec!["Authorization", "Accept", "Cache-Control"]);
|
||||
warp::serve(websocket.or(routes).with(cors)).run(address);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user