Skip to content

Commit

Permalink
fix: font cache headers, leaflet marker img.
Browse files Browse the repository at this point in the history
  • Loading branch information
morganney committed Jan 22, 2024
1 parent 99d6501 commit 874438a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/ui/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createRoot } from 'react-dom/client'
import { RouterProvider } from 'react-router-dom'
import { Icon } from 'leaflet'

import { router } from './router.js'

Expand All @@ -8,4 +9,11 @@ import 'leaflet/dist/leaflet.css'
const rootEl = document.querySelector('main') as HTMLElement
const root = createRoot(rootEl)

Icon.Default.prototype.options.iconUrl =
'https://unpkg.com/[email protected]/dist/images/marker-icon.png'
Icon.Default.prototype.options.iconRetinaUrl =
'https://unpkg.com/[email protected]/dist/images/marker-icon-2x.png'
Icon.Default.prototype.options.shadowUrl =
'https://unpkg.com/[email protected]/dist/images/marker-shadow.png'

root.render(<RouterProvider router={router} />)
5 changes: 5 additions & 0 deletions packages/web/templates/default.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ server {
add_header Cache-Control "max-age=604800, must-revalidate";
}

location ~* \.ttf$ {
include /etc/nginx/conf.d/core/headers.conf;
add_header Cache-Control "max-age=31536000, must-revalidate";
}

# Do not cache index.html for SPA
location ~* ^.+.html$ {
include /etc/nginx/conf.d/core/headers.conf;
Expand Down
5 changes: 5 additions & 0 deletions packages/web/templates/deploy.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ server {
add_header Cache-Control "max-age=604800, must-revalidate";
}

location ~* \.ttf$ {
include /etc/nginx/conf.d/core/headers.conf;
add_header Cache-Control "max-age=31536000, must-revalidate";
}

# Do not cache index.html for SPA
location ~* ^.+.html$ {
include /etc/nginx/conf.d/core/headers.conf;
Expand Down

0 comments on commit 874438a

Please sign in to comment.