Files
2a6764edc5 feat: add reusable network access group APIs (#41025)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: CodingOnStar <hanxujiang@dify.com>
Co-authored-by: hjlarry <hjlarry@163.com>
Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com>
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
2026-10-20 05:52:18 +00:00

16 lines
586 B
TypeScript

import Negotiator from 'negotiator'
import { APP_UNAVAILABLE_PATH } from './document-constants'
import { getBrowserLocale } from './locale'
/** The proxy-owned error route skips application bootstrap and uses the visitor locale. */
export function getAppAccessErrorDocument(requestHeaders: Pick<Headers, 'get'>) {
if (requestHeaders.get('x-dify-pathname') !== APP_UNAVAILABLE_PATH) return undefined
return {
locale: getBrowserLocale(
new Negotiator({
headers: { 'accept-language': requestHeaders.get('accept-language') ?? '' },
}).languages(),
),
}
}