mirror of
https://github.com/langgenius/dify.git
synced 2026-11-11 13:51:25 +08:00
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>
16 lines
586 B
TypeScript
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(),
|
|
),
|
|
}
|
|
}
|