vite-pwa / docs

Documentation: PWA integrations for Vite and the ecosystem
https://vite-pwa-org.netlify.app/
MIT License
197 stars 44 forks source link

better way for nginx prxoy s3 bucket images #53

Closed reslear closed 1 year ago

reslear commented 1 year ago

hi userquin what is a better way for use case:

I have, an nginx proxy for aws up/ after the prefix, for example, https://site.com/up/bucket-folder/dir/image.jpg, how to cache dynamic images for /up/*.jpg or any file ext:

 runtimeCaching: [
        {
          urlPattern: /\/up\/.*\/*/,
          handler: 'CacheFirst',
          options: {
            cacheName: 'images-cache',
            expiration: {
              maxEntries: 10,
              maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
            },
            cacheableResponse: {
              statuses: [0, 200],
            },
          },
        },
      ],

is the right solution?

I get 404 page, but it works after hard-reload in vite preview mode, don't understand why :(

reslear commented 1 year ago

works after add:

      navigateFallbackDenylist: [
        // exclude up: has its own cache
        /^\/up\//,
      ],