mirror of https://github.com/halo-dev/halo
Support resolving static resources at halo work directory (#4285)
#### What type of PR is this? /kind feature /area core /milestone 2.8.x #### What this PR does / why we need it: Support resolving static resources at halo work directory `${halo.work-dir}/static/`. Please note that we only support adding static resources at hand by logging in the server. #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/4087 #### Special notes for your reviewer: 1. Create a file `index.html` at `${halo.work-dir}/static` 2. Edit the file with any content 3. Browse with `http://localhost:8090/index.html` #### Does this PR introduce a user-facing change? ```release-note 支持静态资源映射 ```pull/4287/head
parent
9bea5ef1c9
commit
5ce47190fa
|
@ -160,6 +160,13 @@ public class WebFluxConfig implements WebFluxConfigurer {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var haloStaticPath = haloProp.getWorkDir().resolve("static");
|
||||||
|
registry.addResourceHandler("/**")
|
||||||
|
.addResourceLocations(FILE_URL_PREFIX + haloStaticPath + "/")
|
||||||
|
.addResourceLocations(resourceProperties.getStaticLocations())
|
||||||
|
.setCacheControl(CacheControl.noCache())
|
||||||
|
.setUseLastModified(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue