Skip to content

Commit

Permalink
Only serve static assets out of /assets
Browse files Browse the repository at this point in the history
This avoids Spring doing resource resolution for every link on page
which seems to cost us over 100ms on some pages in some environments.

See: spring-projects/spring-framework#27538
  • Loading branch information
ato committed Jan 5, 2023
1 parent 7797070 commit 35f41a5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ui/resources/application.properties
Expand Up @@ -50,6 +50,8 @@ server.servlet.context-path=${CONTEXT_PATH:/}
spring.web.resources.cache.cachecontrol.max-age=1d
spring.web.resources.chain.strategy.content.enabled=true
spring.web.resources.chain.strategy.content.paths=/**
spring.web.resources.static-locations=classpath:/static/assets/
spring.mvc.static-path-pattern=/assets/**
# Obey X-Forwarded-* headers
server.forward-headers-strategy=NATIVE
server.tomcat.remoteip.remote-ip-header=X-Forwarded-For
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion ui/resources/templates/MarcExport.html
Expand Up @@ -18,7 +18,7 @@
<script th:src="@{/webjars/webshim/1.15.8/dev/polyfiller.js}" defer></script>
<script th:src="@{/webjars/datatables/1.10.21/js/jquery.dataTables.min.js}" defer></script>
<script th:src="@{/webjars/datatables/1.10.21/js/dataTables.bootstrap4.min.js}" defer></script>
<script th:src="@{/marcexport/MarcExport.js}" defer></script>
<script th:src="@{/assets/MarcExport.js}" defer></script>

<style>
form textarea {
Expand Down

0 comments on commit 35f41a5

Please sign in to comment.