I discovered it doesn't work for friendly urls, it shows hyperlinks targeting site collection, so it's not possible to reach other pages. Moreover you'll get this error if you only create a outbuond rule for URL rewriting because of the gzip compression.
Outbound rewrite rules cannot be applied when the content of the HTTP response is encoded ("gzip").
What you have to do is something like this:
- Introduce a outbound rule which rewritest some links
- Introduce rewrite rules for gzip compression
- Local site collection is: http://sitecollection.example.cloud
- Public azure url is: http://publicsite.example.azure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | < configuration > < system .webserver = "" > < rewrite > < rules > < rule name = "ReverseProxyInboundRule" stopprocessing = "true" > < match url = "(.*)" > < servervariables > < set name = "HTTP_X_ORIGINAL_ACCEPT_ENCODING" value = "{HTTP_ACCEPT_ENCODING}" > < set name = "HTTP_ACCEPT_ENCODING" value = "" > </ set ></ set ></ servervariables > </ action ></ match ></ rule > </ rules > < outboundrules rewritebeforecache = "true" > < rule enabled = "true" name = "RestoreAcceptEncoding" precondition = "NeedsRestoringAcceptEncoding" > < match pattern = "^(.*)" servervariable = "HTTP_ACCEPT_ENCODING" > < action type = "Rewrite" value = "{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" > </ action ></ match ></ rule > < rule enabled = "true" name = "ReverseProxyOutboundRule" precondition = "ResponseIsHtml" > < match filterbytags = "A, Img" pattern = "^http(s)?://sitecollection.example.cloud/(.*)" > < action type = "Rewrite" value = "http{R:1}://publicsite.example.azure/{R:2}" > </ action ></ match ></ rule > < preconditions > < precondition name = "NeedsRestoringAcceptEncoding" > < add input = "{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" pattern = ".+" > </ add ></ precondition > < precondition name = "ResponseIsHtml" > < add input = "{RESPONSE_CONTENT_TYPE}" pattern = "^text/html" > </ add ></ precondition > </ preconditions > </ outboundrules > </ rewrite > </ system > </ configuration > |
0 commenti:
Post a Comment
Because of a lot of SPAM about courses, I need to moderate all comments here.
I ensure you that I will answer whenever possible (if you are not a spammer).