Browse Source

Add proxy routes in startup_default(…)

Ben Schulz 2 năm trước cách đây
mục cha
commit
2c787f85f4
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      src/server/mod.rs

+ 3 - 1
src/server/mod.rs

@@ -447,7 +447,9 @@ pub async fn startup_default(ip: String, port: u16, config: CrateConfig) -> Resu
         .service(ServeDir::new(config.crate_dir.join(&dist_path)));
 
     let mut router = Router::new().route("/_dioxus/ws", get(ws_handler));
-
+    for proxy_config in config.dioxus_config.web.proxy.unwrap_or_default() {
+        router = proxy::add_proxy(router, &proxy_config)?;
+    }
     router = router
         .fallback(
             get_service(file_service).handle_error(|error: std::io::Error| async move {