chore: allow 127.0.0.1 origin by default

feat/type-attributes
Tomáš Mládek 2023-05-03 16:06:29 +02:00
parent 669d686a0a
commit ad334065fd
1 changed files with 2 additions and 0 deletions

View File

@ -354,8 +354,10 @@ fn main() -> Result<()> {
let cors = Cors::default()
.allowed_origin("http://localhost")
.allowed_origin("http://127.0.0.1")
.allowed_origin_fn(|origin, _req_head| {
origin.as_bytes().starts_with(b"http://localhost:")
|| origin.as_bytes().starts_with(b"http://127.0.0.1:")
})
.allowed_origin_fn(move |origin, _req_head| {
allowed_origins.iter().any(|allowed_origin| {