konsav
middleware/redirect.global.js
export default defineNuxtRouteMiddleware(async (to, from) => {
const { $getApiData } = useNuxtApp();
if (to.path.includes("/test/") || to.path.includes("/test/abc")) {
const data = await $getApiData.fetchData(
$../redirect/url/${encodeURIComponent(
to.fullPath
)}
);
const response = decodeURIComponent(data);
await navigateTo(response, {
redirectCode: 301,
external: true,
});
}
});16 replies
Cache-Control: max-age=604800, public.
I add in server/plugin/header.ts
import { RenderResponse } from "nitropack";
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook("render:response", (res: RenderResponse, { event }) => {
res.headers["X-Frame-Options"] = "DENY";
res.headers["Cache-Control"] = "no-cache";
});
});
It adds in Cache-Control: no-cache but it appears max-age yet.
4 replies