diff options
author | kontrollanten <6680299+kontrollanten@users.noreply.github.com> | 2021-12-02 09:14:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-02 09:14:54 +0100 |
commit | 5fc44b57f8da090baccd7e4ea7d03773190e4e87 (patch) | |
tree | 5ce47e6194b8bc69e39459adef116eb32a12e0e1 /server/lib/client-html.ts | |
parent | decbd0b63bf14b55c265b0faee18521e4b0e1e76 (diff) | |
download | PeerTube-5fc44b57f8da090baccd7e4ea7d03773190e4e87.tar.gz PeerTube-5fc44b57f8da090baccd7e4ea7d03773190e4e87.tar.zst PeerTube-5fc44b57f8da090baccd7e4ea7d03773190e4e87.zip |
Add header Vary Accept-Language (#4588)
* nginx: add header Vary Accept-Language
solves #3647
* Revert "nginx: add header Vary Accept-Language"
This reverts commit 90dccf53247882ad30904e4c950b745c4e859e01.
* add resp header Vary Accept-Language
solves #3647
* don't add vary header to embed page
Diffstat (limited to 'server/lib/client-html.ts')
-rw-r--r-- | server/lib/client-html.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts index b2948254b..360b4667f 100644 --- a/server/lib/client-html.ts +++ b/server/lib/client-html.ts | |||
@@ -555,9 +555,13 @@ class ClientHtml { | |||
555 | } | 555 | } |
556 | } | 556 | } |
557 | 557 | ||
558 | function sendHTML (html: string, res: express.Response) { | 558 | function sendHTML (html: string, res: express.Response, localizedHTML: boolean = false) { |
559 | res.set('Content-Type', 'text/html; charset=UTF-8') | 559 | res.set('Content-Type', 'text/html; charset=UTF-8') |
560 | 560 | ||
561 | if (localizedHTML) { | ||
562 | res.set('Vary', 'Accept-Language') | ||
563 | } | ||
564 | |||
561 | return res.send(html) | 565 | return res.send(html) |
562 | } | 566 | } |
563 | 567 | ||
@@ -586,5 +590,5 @@ export { | |||
586 | async function generateHTMLPage (req: express.Request, res: express.Response, paramLang?: string) { | 590 | async function generateHTMLPage (req: express.Request, res: express.Response, paramLang?: string) { |
587 | const html = await ClientHtml.getDefaultHTMLPage(req, res, paramLang) | 591 | const html = await ClientHtml.getDefaultHTMLPage(req, res, paramLang) |
588 | 592 | ||
589 | return sendHTML(html, res) | 593 | return sendHTML(html, res, true) |
590 | } | 594 | } |