13 lines
481 B
TypeScript
13 lines
481 B
TypeScript
/** Cache headers for generate/prompt routes. Case-sensitive; not nitro routeRules. */
|
|
export default defineEventHandler((event) => {
|
|
const path = getRequestURL(event).pathname
|
|
if (path.startsWith('/api/generate/')) {
|
|
setHeader(event, 'Cache-Control', 'no-cache, no-store, no-transform')
|
|
setHeader(event, 'X-Accel-Buffering', 'no')
|
|
return
|
|
}
|
|
if (path.startsWith('/api/prompt/')) {
|
|
setHeader(event, 'Cache-Control', 'no-cache, no-store, no-transform')
|
|
}
|
|
})
|