Заметки: Передача имени из SNI на upstream в Nginx

Передача имени из SNI на upstream-серверы может потребоваться в том случае, если бэкэнд-приложение жестко завязано на имени сервиса. В этом случае необходимо изменить ряд настроек по умолчанию на Nginx


Если вам интересна тематика Debian и связанных с ним приложений, рекомендую обратиться к тегу Debian на моем блоге.


Передача имени ресурса из SNI

В статье Несколько сертификатов на Nginx я рассматривал процесс настройки обратного прокси Nginx таким образом, чтобы он раскидывал запросы к разным ресурсам, каждый из которых имеет свое уникальное имя и свой отдельный сертификат. В этой статье я расскажу об одном нюансе работы данного механизма.


Предлагаю ознакомиться с другими статьями про Nginx на моем блоге:

Приятного чтения!


Теория

Несмотря на то, что Nginx распределяет запросы пользователей по бэкэнд-серверам исходя из имени ресурса в SNI, на бэкэнды он этот параметр по умолчанию не передает. То есть, бэкэнд вероятнее всего увидит обращение по его собственному ip-адресу, а не красивый fqdn. Все бы ничего, но для некоторых сервисов (например Windows Server WAP) такое поведение может быть нежелательным и они будут обрывать соединение (RST, ACK) сразу после TLS Client Hello от Nginx. Вот как это выглядит в WireShark:

Полный вывод сессии в текстовом формате:

Если включить дебаг в Nginx, то можете получать подобные сообщения:

Примечание: пример выше — строка из лога общения обратного прокси на Nginx с Windows Server WAP, через который опубликован сервис AD FS.

В нем содержится как причина разрыва соединения — peer closed connection in SSL handshake (104: Connection reset by peer) while SSL handshaking to upstream — так и конечный URL, который дошел до бэкэнд-сервера — https://10.16.1.51:443/adfs/ls/idpinitiatedsignon.htm. Итого, наша задача — передавать на upstream-серверы имя ресурса, по которому изначально обращается клиент.

Настройки

Первой и самой главной опцией, разрешающей передачу имени ресурса на upstream-серверы, является proxy_ssl_server_name 1. Необходимо выставить её в значение on и определить имя ресурса в директиве proxy_pass. Выглядеть это будет следующим образом (это первый вариант):

Второй вариант заключается в переопределении имени ресурса в нужной вам секции конфигурации Nginx. Для этого нужны параметры:

  • proxy_ssl_name 2 — переопределяет имя сервера;
  • proxy_set_header 3 — переопределяет необходимые поля заголовка запроса. В нашем случае понадобится заголовок Host.

В моем случае устанавливать нужное имя ресурса логично в секции location {}. Итак, получаем:

Как итог — сервис работает нормально.

comments powered by HyperComments
1basketball
2022-06-18 18:21:06
<strong>3championships</strong>
phd thesis vs dissertation
2022-07-05 15:45:09
<strong>dissertation proposal sample https://professionaldissertationwriting.org/</strong>
english dissertation help
2022-07-05 20:38:46
<strong>writing a master's dissertation https://helpwithdissertationwritinglondon.com/</strong>
help writing
2022-07-06 00:21:08
<strong>dissertation express https://dissertationwritingcenter.com/</strong>
whats a dissertation
2022-07-06 01:00:59
<strong>doctoral dissertation help https://dissertationhelpexpert.com/</strong>
dissertation help service
2022-07-06 03:50:13
<strong>masters dissertation writing services uk https://accountingdissertationhelp.com/</strong>
cheap dissertation writing services
2022-07-06 07:44:16
<strong>dissertation proposal example https://examplesofdissertation.com/</strong>
what is a dissertation
2022-07-06 10:46:59
<strong>help tutor https://writing-a-dissertation.net/</strong>
dissertation writing advice
2022-07-06 11:40:32
<strong>best dissertation writing services uk https://bestdissertationwritingservice.net/</strong>
uf dissertation format
2022-07-06 16:11:51
<strong>writing an abstract for a dissertation https://businessdissertationhelp.com/</strong>
dissertation online help
2022-07-06 16:51:43
<strong>dissertation writing and editing https://customdissertationwritinghelp.com/</strong>
dissertations writing
2022-07-06 20:47:45
<strong>dissertation chapters https://writingadissertationproposal.com/</strong>
all but dissertation
2022-07-06 23:48:41
<strong>order a dissertation https://dissertationhelpspecialist.com/</strong>
dissertation chapters
2022-07-07 02:52:51
<strong>bestdissertation https://dissertationhelperhub.com/</strong>
data analysis dissertation help
2022-07-07 04:58:12
<strong>masters dissertation writing services uk https://customthesiswritingservices.com/</strong>
online casino spanish
2022-07-25 18:58:52
<strong>pa online casino apps https://download-casino-slots.com/</strong>
goldennugget casino online
2022-07-25 21:12:51
<strong>online casino play for real money https://firstonlinecasino.org/</strong>
online casino live
2022-07-26 00:19:03
<strong>pa online casino no deposit bonus https://onlinecasinofortunes.com/</strong>
live casino games online
2022-07-26 05:37:13
<strong>river belle online casino https://trust-online-casino.com/</strong>
best online casino promotions
2022-07-26 08:19:53
<strong>betmgm online casino michigan https://onlinecasinosdirectory.org/</strong>
harrah's casino online
2022-07-26 13:16:25
<strong>new online casino with free signup bonus real money usa https://free-online-casinos.net/</strong>
live casino online real money
2022-07-26 14:33:13
<strong>royaloander online casino https://internet-casinos-online.net/</strong>
caesars pa online casino bonus code
2022-07-26 16:46:10
<strong>online casino usa https://cybertimeonlinecasino.com/</strong>
harrahs online casino
2022-07-26 20:33:38
<strong>bogata online casino https://1freeslotscasino.com/</strong>
casino card games online
2022-07-26 22:16:35
<strong>online casino with free signup bonus real money usa 2020 https://vrgamescasino.com/</strong>
usa online casino
2022-07-27 01:17:51
<strong>codeshare online double down casino https://casino-online-roulette.com/</strong>
real money online casino no deposit bonus
2022-07-27 04:45:45
<strong>top casino online https://casino-online-jackpot.com/</strong>
grand online casino
2022-07-27 06:11:48
<strong>casino live online https://onlineplayerscasino.com/</strong>
beste online casino
2022-07-27 09:26:55
<strong>turning stone online casino https://ownonlinecasino.com/</strong>
betmgm pa online casino
2022-07-27 11:44:15
<strong>harrahs casino online https://all-online-casino-games.com/</strong>
online casino game
2022-07-27 13:54:38
<strong>fastest payout online casino usa https://casino8online.com/</strong>
what is vpn
2022-08-07 16:02:51
<strong>best cheap vpn https://freevpnconnection.com/</strong>
free vpn for netflix
2022-08-07 18:03:20
<strong>vpn best https://shiva-vpn.com/</strong>
free vpn for pc
2022-08-07 19:45:52
<strong>unlimited free vpn - hola https://freehostingvpn.com/</strong>
using vpn to buy crypto
2022-08-07 21:37:33
<strong>best vpn mac https://ippowervpn.net/</strong>
turbo vpn download
2022-08-08 01:38:09
<strong>cisco vpn https://imfreevpn.net/</strong>
reddit best free vpn
2022-08-08 05:05:16
<strong>the best free vpn https://free-vpn-proxy.com/</strong>
free p2p vpn
2022-08-08 07:35:25
<strong>best vpn service 2022 https://rsvpnorthvalley.com/</strong>
gay teen dating an older partner
2022-08-23 15:26:02
<strong>older gay dating sites https://gay-singles-dating.com/</strong>
indianapolis gay dating
2022-08-23 17:14:52
<strong>chub mature gay bisexual dating https://gayedating.com/</strong>
gree gay dating sites
2022-08-23 20:04:15
<strong>best dating apps for gay https://datinggayservices.com/</strong>
site of dating
2022-08-24 12:16:36
<strong>dating personals https://freephotodating.com/</strong>
local-singles club
2022-08-24 16:20:59
<strong>freeca https://onlinedatingbabes.com/</strong>
mature woman dating pictures
2022-08-24 18:31:15
<strong>free site dating https://adult-singles-online-dating.com/</strong>
dating services contact germany
2022-08-24 20:25:01
<strong>lesbian mature https://adult-classifieds-online-dating.com/</strong>
dating chat
2022-08-24 22:03:30
<strong>single woman free https://online-internet-dating.net/</strong>
single chat sites
2022-08-25 01:13:00
<strong>our time dating website login https://speedatingwebsites.com/</strong>
fb dating
2022-08-25 02:59:03
<strong>date sex https://datingpersonalsonline.com/</strong>
dating site sign up
2022-08-25 05:08:13
<strong>meet women for free online https://wowdatingsites.com/</strong>
pof login online
2022-08-25 09:43:58
<strong>free sites sites https://freeadultdatingpasses.com/</strong>
singles dating sites
2022-08-25 15:37:26
<strong>free online go https://onlinedatingservicesecrets.com/</strong>
real money online casino no deposit bonus codes
2022-08-30 08:47:00
<strong>888 online casino nj https://onlinecasinos4me.com/</strong>
best online casino slots
2022-08-30 15:40:52
<strong>sugarhouse casino online pa https://online2casino.com/</strong>
casino online free
2022-08-30 19:56:17
<strong>firekeepers online casino https://casinosonlinex.com/</strong>
gay boy teen boys webcam chat rooms
2022-09-03 00:11:11
<strong>free gay sex chat https://newgaychat.com/</strong>
oc gay chat rooms
2022-09-03 06:59:09
<strong>gay phone chat meet locals "welcome to the https://gaychatcams.net/</strong>
gay latin chat
2022-09-03 16:26:31
<strong>gay chat lines in atlanta https://gay-live-chat.net/</strong>
gay webcam chat software
2022-09-03 23:41:56
<strong>free chat with men - live gay cams, free gay webcams at chaturbate https://gayphillychat.com/</strong>
gay chat room in nj
2022-09-04 07:56:13
<strong>rastaboy gay chat https://gaychatnorules.com/</strong>
chat avenue gay chat
2022-09-04 13:18:38
<strong>free gay bi chat lines in seattle wa https://gaymusclechatrooms.com/</strong>
gay chat phoenix
2022-09-04 17:55:29
<strong>gay chat rooms of pa https://free-gay-sex-chat.com/</strong>
gay sex video chat
2022-09-04 20:08:12
<strong>free gay chat nrooms https://gayinteracialchat.com/</strong>
best gay chat site 2017
2022-10-20 17:14:43
<strong>cookeville tn gay chat https://gaymanchatrooms.com/</strong>
order a paper online
2022-10-20 18:18:50
<strong>order a paper online https://term-paper-help.org/</strong>
paper writer services
2022-10-20 19:30:19
<strong>buying college papers online https://sociologypapershelp.com/</strong>
custom paper
2022-10-20 20:34:47
<strong>paper writers for college https://uktermpaperwriters.com/</strong>
write my college paper
2022-10-20 21:49:56
<strong>help with paper https://paperwritinghq.com/</strong>
help writing my paper
2022-10-21 01:17:33
<strong>cheap custom papers https://write-my-paper-for-me.org/</strong>
need help writing a paper
2022-10-21 02:12:21
<strong>find someone to write my paper https://doyourpapersonline.com/</strong>
write my paper in 3 hours
2022-10-21 04:15:42
<strong>do my college paper for me https://top100custompapernapkins.com/</strong>
pay for a paper
2022-10-21 05:39:04
<strong>college papers help https://researchpaperswriting.org/</strong>
can i pay someone to write my paper
2022-10-21 07:30:18
<strong>college paper writer https://writingpaperservice.net/</strong>
pay someone to write your paper
2022-10-21 09:32:27
<strong>buy school papers https://buyessaypaperz.com/</strong>
pay to do my paper
2022-10-21 10:08:36
<strong>write my math paper https://mypaperwritinghelp.com/</strong>
help with filing divorce papers
2022-10-21 13:27:37
<strong>cheap paper writing service https://essaybuypaper.com/</strong>
pay to do paper
2022-10-21 14:12:55
<strong>custom paper writing service https://papercranewritingservices.com/</strong>
custom paper service
2022-10-21 15:51:37
<strong>write my paper apa style https://premiumpapershelp.com/</strong>
order a paper
2022-10-21 17:19:17
<strong>write my apa paper https://ypaywallpapers.com/</strong>
write my paper for money
2022-10-21 18:03:57
<strong>buy a paper https://studentpaperhelp.com/</strong>
1spellbound
2023-01-27 02:09:40
<strong>3miracle</strong>
coursework only degree
2023-02-05 14:31:56
<strong>coursework service https://brainycoursework.com/</strong>
coursework moderation
2023-02-05 16:22:29
<strong>coursework science https://courseworkninja.com/</strong>
coursework plagiarism
2023-02-05 17:25:42
<strong>coursework moderation https://writingacoursework.com/</strong>
coursework website
2023-02-05 19:08:04
<strong>custom coursework writing https://mycourseworkhelp.net/</strong>
coursework writer uk
2023-02-05 20:38:13
<strong>cpa coursework https://courseworkdownloads.com/</strong>
do my coursework online
2023-02-05 22:10:07
<strong>coursework writing uk https://courseworkinfotest.com/</strong>
coursework writing service
2023-02-05 22:42:25
<strong>buy coursework online https://coursework-expert.com/</strong>
coursework papers
2023-02-06 00:00:59
<strong>coursework website https://teachingcoursework.com/</strong>
2023-02-06 01:14:05
<strong>do my coursework online https://buycoursework.org/</strong>
coursework planner
2023-02-06 02:31:24
<strong>coursework samples https://courseworkdomau.com/</strong>
local singles in my area
2023-02-08 12:30:35
<strong>best dating website in usa https://freewebdating.net/</strong>
searchingforsingles
2023-02-08 14:38:38
<strong>christian dating for free https://jewish-dating-online.net/</strong>
free single personal ads
2023-02-08 16:38:29
<strong>12 single dating site https://free-dating-sites-free-personals.com/</strong>
mature woman dating pictures
2023-02-08 18:54:43
<strong>singles https://onlinedatingsurvey.com/</strong>
meet online service
2023-02-08 19:50:20
<strong>all dating sites in usa https://onlinedatingsuccessguide.com/</strong>
dating women online
2023-02-08 21:41:36
<strong>dating near me free https://onlinedatinghunks.com/</strong>
dating dating site
2023-02-08 22:33:54
<strong>cdff dating site login https://datingwebsiteshopper.com/</strong>
totally free dating service
2023-02-09 01:06:38
<strong>single seniors dating site https://freedatinglive.com/</strong>
Яндекс.Метрика