diff options
author | Akshay <[email protected]> | 2020-12-20 12:18:31 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2020-12-20 12:18:31 +0000 |
commit | 375fc45f310476a0a49fc48054f6563c8e02e2f6 (patch) | |
tree | c40bd576a8cc803051af234b9a30b0f3cb8f729e /src/bin | |
parent | 8026ac574e6b8e1aeb868c970b780c72f655928b (diff) |
fix cookies/cors, more logging
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/server.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/bin/server.rs b/src/bin/server.rs index 5af3135..7c67e4f 100644 --- a/src/bin/server.rs +++ b/src/bin/server.rs | |||
@@ -24,9 +24,24 @@ async fn main() -> std::io::Result<()> { | |||
24 | .wrap(IdentityService::new( | 24 | .wrap(IdentityService::new( |
25 | CookieIdentityPolicy::new(&private_key) | 25 | CookieIdentityPolicy::new(&private_key) |
26 | .name("user-login") | 26 | .name("user-login") |
27 | .domain("127.0.0.1") | ||
28 | .path("/") | ||
29 | .same_site(actix_web::cookie::SameSite::None) | ||
30 | .http_only(true) | ||
27 | .secure(false), | 31 | .secure(false), |
28 | )) | 32 | )) |
29 | .wrap(Cors::new().supports_credentials().finish()) | 33 | .wrap( |
34 | Cors::default() | ||
35 | .allowed_origin("http://127.0.0.1:8000") | ||
36 | .allowed_origin("http://localhost:8000") | ||
37 | .allow_any_method() | ||
38 | .allow_any_header(), | ||
39 | ) | ||
40 | .wrap( | ||
41 | middleware::DefaultHeaders::new() | ||
42 | .header("Access-Control-Allow-Credentials", "true") | ||
43 | .header("Access-Control-Expose-Headers", "set-cookie"), | ||
44 | ) | ||
30 | .wrap(middleware::Logger::default()) | 45 | .wrap(middleware::Logger::default()) |
31 | .data(pool.clone()) | 46 | .data(pool.clone()) |
32 | .service( | 47 | .service( |