don't cache assets in the CLI (#1742)
This commit is contained in:
1 parent
c56d3662e9
commit
f913b2ce53
1 file changed
+9
-1
@@ -11,6 +11,7 @@ use axum::{
|
|||||||
body::{Full, HttpBody},
|
body::{Full, HttpBody},
|
||||||
extract::{ws::Message, Extension, TypedHeader, WebSocketUpgrade},
|
extract::{ws::Message, Extension, TypedHeader, WebSocketUpgrade},
|
||||||
http::{
|
http::{
|
||||||
|
self,
|
||||||
header::{HeaderName, HeaderValue},
|
header::{HeaderName, HeaderValue},
|
||||||
Method, Response, StatusCode,
|
Method, Response, StatusCode,
|
||||||
},
|
},
|
||||||
@@ -262,7 +263,7 @@ async fn setup_router(
|
|||||||
.override_response_header(HeaderName::from_static("cross-origin-opener-policy"), coop)
|
.override_response_header(HeaderName::from_static("cross-origin-opener-policy"), coop)
|
||||||
.and_then(
|
.and_then(
|
||||||
move |response: Response<ServeFileSystemResponseBody>| async move {
|
move |response: Response<ServeFileSystemResponseBody>| async move {
|
||||||
let response = if file_service_config
|
let mut response = if file_service_config
|
||||||
.dioxus_config
|
.dioxus_config
|
||||||
.web
|
.web
|
||||||
.watcher
|
.watcher
|
||||||
@@ -290,6 +291,13 @@ async fn setup_router(
|
|||||||
} else {
|
} else {
|
||||||
response.map(|body| body.boxed())
|
response.map(|body| body.boxed())
|
||||||
};
|
};
|
||||||
|
let headers = response.headers_mut();
|
||||||
|
headers.insert(
|
||||||
|
http::header::CACHE_CONTROL,
|
||||||
|
HeaderValue::from_static("no-cache"),
|
||||||
|
);
|
||||||
|
headers.insert(http::header::PRAGMA, HeaderValue::from_static("no-cache"));
|
||||||
|
headers.insert(http::header::EXPIRES, HeaderValue::from_static("0"));
|
||||||
Ok(response)
|
Ok(response)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user