Исходный код вики Проблемы и сценарии
Редактировал(а) Alexandr Fokin 2023/01/28 20:46
Последние авторы
author | version | line-number | content |
---|---|---|---|
1 | |(% style="width:262px" %)Отключения настройки | ||
2 | "Reverse rewrite host in response headers"|(% style="width:1231px" %)((( | ||
3 | Возможны случаи, когда веб приложение будет формировать html страницы, содержащие некорректные ссылки. Например ссылающиеся не на адрес прокси, а на внутренний адрес приложения. | ||
4 | Потребуется, что прокси модифицировал исходящие страницы, переписывая содержимое на основе некоторых правил. | ||
5 | |||
6 | IIS reverse proxy with rewrites can't handle a redirect from the server we proxy to | ||
7 | https://stackoverflow.com/questions/4243959/iis-reverse-proxy-with-rewrites-cant-handle-a-redirect-from-the-server-we-proxy | ||
8 | ))) | ||
9 | |(% style="width:262px" %)Переписывание заголовков во входящих запросах для отключения сжатия в ответах сервера приложения. | ||
10 | (Например gzip)|(% style="width:1231px" %)((( | ||
11 | У IIS могут возникнуть проблем с изменением содержимого страницы, если ответ от сервера приложения возвращается в сжатом виде. | ||
12 | |||
13 | IIS as a reverse proxy - compression of rewritten response from backend server | ||
14 | https://stackoverflow.com/questions/15926203/iis-as-a-reverse-proxy-compression-of-rewritten-response-from-backend-server | ||
15 | |||
16 | The server variable is not allowed to be set. | ||
17 | http://www.sansys.net/2015/01/server-variable-is-not-allowed-to-be-set.html | ||
18 | |||
19 | Замечание: заголовок с указанием сжатия для html контента, и для ответа от web api могут быть разными. | ||
20 | ))) | ||
21 | |(% style="width:262px" %)Переписывание редирект ссылок в хедерах ответов от севера приложения|(% style="width:1231px" %)Modifying HTTP Response Headers | ||
22 | https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/modifying-http-response-headers | ||
23 | |(% style="width:262px" %)Переписывание ссылок в html страницах, json ответах web api и другом контенте.|(% style="width:1231px" %)((( | ||
24 | How to fix URL Rewriting for links inside CSS files with IIS7 | ||
25 | https://stackoverflow.com/questions/8653399/how-to-fix-url-rewriting-for-links-inside-css-files-with-iis7 | ||
26 | |||
27 | Замечание: паттерн сопоставления в html страницах и json документах могут различаться в следствии наличия/отсутствия/различии в экранировании символов. | ||
28 | |||
29 | {{code language="xml"}} | ||
30 | <outboundRules> | ||
31 | <preConditions> | ||
32 | <preCondition name="IsRedirection"> | ||
33 | <add input="{RESPONSE_STATUS}" pattern="3\d\d" ></add> | ||
34 | </preCondition> | ||
35 | <preCondition name="ResponseIsHtml"> | ||
36 | <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" ></add> | ||
37 | </preCondition> | ||
38 | <preCondition name="ResponseIsJson"> | ||
39 | <add input="{RESPONSE_CONTENT_TYPE}" pattern="^application/json" ></add> | ||
40 | </preCondition> | ||
41 | </preConditions> | ||
42 | <rule name="Rewrite Location Header" preCondition="IsRedirection" stopProcessing="true"> | ||
43 | <match serverVariable="RESPONSE_Location" pattern="http://ResponseUrl(.*)" ></match> | ||
44 | <action type="Rewrite" value="https://ProxyUrl{R:1}" ></action> | ||
45 | </rule> | ||
46 | <rule name="Rewrite static content" preCondition="ResponseIsHtml" stopProcessing="true"> | ||
47 | <match filterByTags="None" pattern="http://ResponseUrl" ></match> | ||
48 | <action type="Rewrite" value="https://ProxyUrl" ></action> | ||
49 | </rule> | ||
50 | <rule name="Rewrite api content" preCondition="ResponseIsJson" stopProcessing="true"> | ||
51 | <match filterByTags="None" pattern="http:\\/\\/ResponseUrl" ></match> | ||
52 | <action type="Rewrite" value="https://ProxyUrl" ></action> | ||
53 | </rule> | ||
54 | </outboundRules> | ||
55 | {{/code}} | ||
56 | ))) | ||
57 | |(% style="width:262px" %) |(% style="width:1231px" %) | ||
58 | |(% style="width:262px" %) |(% style="width:1231px" %) |