Front: propagacja X-Forwarded-Proto w nginx app/admin (map $http_x_forwarded_proto zamiast $scheme) — po https przez TLS-terminator Express widzi wlasciwy req.protocol i same-origin sie zgadza (brak falszywego 403 CORS); + test sameOrigin https+port 13xxx
This commit is contained in:
@@ -7,6 +7,14 @@ describe('isSameOrigin — origin requesta vs nagłówek Origin', () => {
|
||||
expect(isSameOrigin('https://tisachi.ddns.net', 'https', 'tisachi.ddns.net')).toBe(true);
|
||||
});
|
||||
|
||||
it('https z niestandardowym portem (staging 13xxx przez TisachiSSL) to same-origin', () => {
|
||||
// X-Forwarded-Proto=https + Host z portem: req.protocol=https, host zostaje z portem
|
||||
expect(isSameOrigin('https://tisachi.ddns.net:13001', 'https', 'tisachi.ddns.net:13001')).toBe(true);
|
||||
expect(isSameOrigin('https://192.168.50.127:13002', 'https', '192.168.50.127:13002')).toBe(true);
|
||||
// ten sam host+port, ale klient po http — dalej cross-origin (inny scheme)
|
||||
expect(isSameOrigin('http://tisachi.ddns.net:13001', 'https', 'tisachi.ddns.net:13001')).toBe(false);
|
||||
});
|
||||
|
||||
it('domyślny port jest niewidoczny po jednej stronie', () => {
|
||||
expect(isSameOrigin('http://api.example.test:80', 'http', 'api.example.test')).toBe(true);
|
||||
expect(isSameOrigin('http://api.example.test', 'http', 'api.example.test:80')).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user