浏览代码

Update cors for production

Lee Morgan 1 月之前
父节点
当前提交
b11bf77017
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/main.rs

+ 2 - 1
src/main.rs

@@ -49,7 +49,8 @@ async fn main() -> std::io::Result<()> {
         } else {
             Cors::default()
                 .allowed_origin_fn(|origin, _req| {
-                    origin.as_bytes().ends_with(b".chatrpg.com")
+                    let bytes = origin.as_bytes();
+                    bytes == b"http://localhost:5173" || bytes == b"https://chatrpg.leemorgan.dev"
                 })
                 .allowed_methods(vec!["GET", "POST", "PUT", "PATCH", "DELETE"])
                 .allow_any_header()