b090f8b810
The NetworkFirst route for /api/* was intercepting the OIDC callback (/api/auth/oauth2/callback/authentik?code=...), returning a cached index.html instead of forwarding to the API server. Added navigateFallbackDenylist regex to exclude the callback path from service worker navigation handling, allowing the callback request to reach the API server normally. Fixes GRO-472. Co-authored-by: Flea Flicker <flea-flicker@groombook.farh.net> Co-authored-by: Paperclip <noreply@paperclip.ing>
72 lines
1.7 KiB
TypeScript
72 lines
1.7 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import { VitePWA } from "vite-plugin-pwa";
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
tailwindcss(),
|
|
VitePWA({
|
|
registerType: "autoUpdate",
|
|
includeAssets: ["favicon.svg", "apple-touch-icon.png"],
|
|
manifest: {
|
|
name: "Groom Book",
|
|
short_name: "GroomBook",
|
|
description: "Pet grooming business management",
|
|
theme_color: "#4f8a6f",
|
|
background_color: "#ffffff",
|
|
display: "standalone",
|
|
scope: "/",
|
|
start_url: "/",
|
|
icons: [
|
|
{
|
|
src: "pwa-192x192.png",
|
|
sizes: "192x192",
|
|
type: "image/png",
|
|
},
|
|
{
|
|
src: "pwa-512x512.png",
|
|
sizes: "512x512",
|
|
type: "image/png",
|
|
},
|
|
{
|
|
src: "pwa-512x512.png",
|
|
sizes: "512x512",
|
|
type: "image/png",
|
|
purpose: "any maskable",
|
|
},
|
|
],
|
|
},
|
|
workbox: {
|
|
globPatterns: ["**/*.{js,css,html,ico,png,svg,woff2}"],
|
|
navigateFallbackDenylist: [
|
|
/^\/api\/auth\/oauth2\/callback\//,
|
|
],
|
|
runtimeCaching: [
|
|
{
|
|
urlPattern: /^http.*\/api\/.*/i,
|
|
handler: "NetworkFirst",
|
|
options: {
|
|
cacheName: "api-cache",
|
|
expiration: {
|
|
maxEntries: 100,
|
|
maxAgeSeconds: 60 * 60 * 24, // 24 hours
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
],
|
|
server: {
|
|
port: 5173,
|
|
proxy: {
|
|
"/api": {
|
|
target: "http://localhost:3000",
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
});
|