fix: try explicitly setting methods and headers
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
This commit is contained in:
parent
8f53c9f718
commit
d67a7ce0ca
1 changed files with 17 additions and 11 deletions
28
src/main.rs
28
src/main.rs
|
@ -1,5 +1,5 @@
|
||||||
use argon2::Argon2;
|
use argon2::Argon2;
|
||||||
use axum::Router;
|
use axum::{http::header, Router};
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use diesel_async::pooled_connection::AsyncDieselConnectionManager;
|
use diesel_async::pooled_connection::AsyncDieselConnectionManager;
|
||||||
use diesel_async::pooled_connection::deadpool::Pool;
|
use diesel_async::pooled_connection::deadpool::Pool;
|
||||||
|
@ -131,16 +131,22 @@ async fn main() -> Result<(), Error> {
|
||||||
.allow_origin(AllowOrigin::predicate(|_origin, _request_head| {
|
.allow_origin(AllowOrigin::predicate(|_origin, _request_head| {
|
||||||
true
|
true
|
||||||
}))
|
}))
|
||||||
// Allow any method
|
.allow_methods(AllowMethods::list([
|
||||||
.allow_methods(AllowMethods::mirror_request())
|
"GET".parse().unwrap(),
|
||||||
// Allow any headers
|
"POST".parse().unwrap(),
|
||||||
.allow_headers(AllowHeaders::mirror_request())
|
"PUT".parse().unwrap(),
|
||||||
/*
|
"PATCH".parse().unwrap(),
|
||||||
vec![
|
"DELETE".parse().unwrap(),
|
||||||
"content-type".parse().unwrap(),
|
"OPTIONS".parse().unwrap(),
|
||||||
"authorization".parse().unwrap(),
|
]))
|
||||||
]
|
.allow_headers(AllowHeaders::list([
|
||||||
*/
|
header::AUTHORIZATION,
|
||||||
|
header::CONTENT_TYPE,
|
||||||
|
header::ORIGIN,
|
||||||
|
header::ACCEPT,
|
||||||
|
header::COOKIE,
|
||||||
|
"x-requested-with".parse().unwrap(),
|
||||||
|
]))
|
||||||
// Allow credentials
|
// Allow credentials
|
||||||
.allow_credentials(true);
|
.allow_credentials(true);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue