Quantcast
Channel: URL Rewrite Module
Viewing all 2482 articles
Browse latest View live

Cannot get redirect rules to work at all

$
0
0

I've been banging my head against a brick wall attempting to get some IIS redirect rules to work. I've searched and read stuff here on Stack Overflow and on IIS.net but it just doesn't work at all.

I'm trying it on my local (real) IIS, I have the rewrite 2.0 module installed and have tried doing a repair install on it. I've done an iisreset at an admin cmd line more times than I care to mention.

In my hosts file I have set-up 127.0.0.1 for the URL my.test.com.

What I want to achieve is given a sub-domain URL redirect to the main domain URL with an extra querystring parameter whilst maintaining the existing path and querystring values if they exist.

I setup 3 rules as follows that are in the root folder of the website:

<system.webServer><rewrite><rules><rule name="PathAndQueryString" enabled="true" stopProcessing="true"><match url="(/\w*)(\?\w*=\w*)([&amp;\w*=\w*]*)" /><action type="Redirect" url="https://www.test.com{R:1}{R:2}{R:3}&amp;param=value" appendQueryString="false" /><conditions logicalGrouping="MatchAll" trackAllCaptures="false"><add input="{HTTP_HOST}" pattern="my.test.com" /></conditions></rule><rule name="Querstring" enabled="true" stopProcessing="true"><match url="(\?\w*=\w*)([&amp;\w*=\w*]*)" /><action type="Redirect" url="https://www.test.com{R:1}{R:2}&amp;param=value" appendQueryString="false" /><conditions><add input="{HTTP_HOST}" pattern="my.test.com" /></conditions></rule><rule name="DomainOnly" enabled="true" stopProcessing="true"><match url=".*" /><action type="Redirect" url="https://www.test.com?param=value" appendQueryString="false" /><conditions><add input="{HTTP_HOST}" pattern="my.test.com" /></conditions></rule></rules></rewrite></system.webServer>

Unfortunately despite testing the patterns and confirming the {R:x} captures are correct when I try to test this using Edge, Chrome, Firefox and IE for all of them IIS acts like the rules don't exist.

Tests:

None of the above tests work, they get served without a redirect.

I've also tried putting the condition pattern used as part of the Match URL pattern but it didn't work with that either; in fact I moved it to the condition after reading a Stack Overflow post which said when rules are in the root of the site it doesn't include the host, but still nothing works.

Any help would be much appreciated.

UPDATE 1: For the path and querystring rule tried removing the bolded part from that start of this pattern (/\w*). Didn't have any effect.

UPDATE 2: Tried enabling the extremely temperamental "Failed Request Tracing" functionality and when it is actually working it says that none of the Match URL patterns are matching, except for the 3rd rule which has now started kicking in and redirecting but is not maintaining the path and other querystring params for obvious reasons.

UPDATE 3: On Edge and IE none of the rules work at all. On Chrome and FF the domain only redirect appears to be working - however if I disable the domain only rule and restart IIS it acts as though the rule is still there - FFS give me strength this crap is really starting to boil my blood now - this should not be that damn difficult.


Routing IP:8006 contents on different Domain:443 - ARR on IIS

$
0
0

Hi,

I want to route traffic from http://ServerIP:8006 tohttps://domainname and for this i have used ARR on IIS with below rules.

Created one Server Farm with server IP: ServerIP with port 8006 in advanced settings.

Globally created Rewrite inbound rule , with action "RoutetoFarm" by using this i am getting expected result onhttp://domainname

however to get same result over https i created Global outbound rule and specified below paramerters,

==================================

<globalRules>
                <rule name="ARR_Endeca_loadbalance" patternSyntax="Wildcard" stopProcessing="true">
                    <match url="*" />
                    <action type="Rewrite" url="http://Endeca/{R:0}" />
                </rule>
            </globalRules>
            <outboundRules>
                <clear />
                <rule name="IsHTML" preCondition="" enabled="true" stopProcessing="true">
                    <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script, CustomTags" customTags="HTML5Tags" pattern="^http.*://(.*)$" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="true" />
                    <action type="Rewrite" value="https://{R:1}" />
                </rule>
                <preConditions>
                    <preCondition name="HTTPS">
                        <add input="{HTTP_HOST}" pattern="(.*)" />
                    </preCondition>
                    <preCondition name="IsHTML" patternSyntax="Wildcard">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="*" />
                    </preCondition>
                </preConditions>
                <customTags>
                    <tags name="asd" />
                    <tags name="HTTPS" />
                    <tags name="HTML5Tags" />
                    <tags name="JSON" />
                    <tags name="*" />
                </customTags>
            </outboundRules>

==============================================

by using above outbound rule i am getting partial result as expected, however also getting below error,

failed to load response data for https while on http it is loading data properly.

please suggest.

Ritesh Khadke.

URL Rewrite | Help understand a regular expression logic

$
0
0

Hi,

I am looking in to an existing ARR farm to document the configurations, could some one please help me understand the below conditions-{KBRedirect:{C:1}{HTTP_HOST}/{R:1}?{QUERY_STRING}}

Here is the Rule description-

Rule starts with (.*) with couple of conditions and action is Redirect {C:2}

Condition1:-  {CACHE_URL} matches pattern ^(https?://)

Condition2:- {KBRedirect:{C:1}{HTTP_HOST}/{R:1}?{QUERY_STRING}} matches pattern (.+)

I cant figure out the 2nd condition input. please help.

Help with rewrite based on A record

$
0
0

Hi,

I have two seperate webservers (one iis and 1 linux box) but only 1 external IP and i'd like to keep both on port 80/443.

I'm trying to have when i enter cloud.nickhosts.xyz it will push to the webserver on 192.168.1.40 but rw.nickhosts.xyz to stay on iis and go to remote workplace.

Is it possible to do this?

Thanks

Redirect loop bug

$
0
0

Hi guys,

I've been getting redirect loops spontaneously happening on my webserver.  It will run fine for weeks and then suddenly start acting up.  The only place I've seen this happen is on my home page. Firebug shows redirects to the home page (e.g. http://www.example.com/) endlessly, it's not bouncing back and forth to other pages.  Once the problem starts, the website has to be restarted for the issue to go away.

I have a canonical host name rule, and then a generic default document redirect + rewrite (e.g. /default.aspx redirects to / and the page is rewritten to /default.aspx).  There are redirects for other pages, and now a redirect map, but this was happening before the map was added.

Any ideas what might be causing this?  Is there some kind of logging I can enable which would help?

External IIS Rewrite RouteMap file changes are not reflected

$
0
0

Hi.

I have an external rewrite routemap file configured for our site. This file is being published to the site's root folder by a content management publishing team.After publishing the file,the changes are not reflected as the IIS recycle is not happening while the Routemap external file updates. As per my undestanding any changes to the bin folder would recycle the app pool.So we are updating a file in the bin folder to do a recycle. This didnt help to resolve the issue.

Any one has faced similar issues ? How can we do a auto refresh when the files are modified externally?

URL Rewrite based on HTTP Body Content

$
0
0

Hi,

I am using the URL Rewrite Module (+ ARR ) for my scenario, and I wrote Rewrite Provider to determine the full "url" based on some conditions. This is a legacy system, and sometimes I can introspect just the REQUEST_URI (something like {MyRewritePRovider:{REQUEST_URI}}).

Now, there are some cases where I need to decide where to route based on the HTTP body content for some HTTP POSTS, and apparently I don't have the content available in any variable, is that right?

So, my question is, is there any workaround, like running something before the URLRewrite module to add the HTTP body content (or just part of it) in a custom variable that we can use later in the URL Rewrite provider? Any idea?

Thanks in advance

Bruno

Rewriter is modifying page content in the response

$
0
0

We are experiencing an issue with an asp.net application (using .Net Framework 4.5.2) where links in pages are being modified and it causes issues in our application.  We are using the rewriter to strip out the url prefix we use to identify user/version/name so that the server can find the actual resource.

My understanding is that the rewriter runs before any iis handlers, and therefore should not be modifying any page content in the response unless Outbound rules are used.  We have links in many pages, such as anchor tags with relative urls.  For example:

mypage.aspx

is transformed to

../../../../mypage.aspx

We are using the following rules, which act to strip out the url prefix we add to the actual url.

<rewrite>
<rules>
<clear />
<rule name="Rewrite1" enabled="true" stopProcessing="true">
<match url="^V1/\w+(?=/)/\w+(?=/)/(.+)" />
<conditions logicalGrouping="MatchAll" />
<action type="Rewrite" url="/{R:1}" />
</rule>
<rule name="Rewrite2" enabled="true" stopProcessing="true">
<match url="^(.*)V1/\w+(?=/)/\w+(?=/)/(.+)" negate="false" />
<conditions logicalGrouping="MatchAny" />
<action type="Rewrite" url="/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>

As far as I can tell from the documentation, these inbound rules should not be modifying content in the response.  I need to know how to prevent this behavior.

Please advise

Regards


Problem with converting .htaccess to web.config

$
0
0

Dear 

I am moving my website from apache server to a IIS 7. 

I am trying to convert my .htaccess but it won't work. : 

# ##############################################################################
# # URL REWRITES #
# ##############################################################################
# ------------------------------------------------------------------------------
# | Rewrite engine |
# ------------------------------------------------------------------------------
# Turning on the rewrite engine and enabling the `FollowSymLinks` option is
# necessary for the following directives to work.
# If your web host doesn't allow the `FollowSymlinks` option, you may need to
# comment it out and use `Options +SymLinksIfOwnerMatch` but, be aware of the
# performance impact: http://httpd.apache.org/docs/current/misc/perf-tuning.html#symlinks
# Also, some cloud hosting services require `RewriteBase` to be set:
<IfModule mod_rewrite.c>
# Options +FollowSymlinks
# Options +SymLinksIfOwnerMatch
RewriteEngine On
# RewriteCond %{HTTP_HOST} !^www\.
# RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?params=$1 [L,QSA]
</IfModule>

IIS URL Rewrite help

$
0
0

Hi there, I am trying to create a Rewrite rule but I seem to be having a lot of trouble with it and the rule i created does not seem to work.

Basically what i like to do is re-write alll URLS that are in the form of http://my-site/folder1/folder2/([_0-9a-z-]+)/([0-9]+) to serve up a pagehttp://my-site/folder1/folder2/mypage.asp?x={R:1}&y={R:2}

Could someone help me create this rule?

I tried doing something like this but it didn't work

<rulename="Rewrite to article.aspx">
   <matchurl="^folder2/([_0-9a-z-]+)/([0-9]+)"/>
   <actiontype="Rewrite"url="mypage.asp?x={R:1}&amp;y={R:2}"/>
</rule>


Thank you in advance.

Reverse Proxy outbound rules links rewriting

$
0
0

Does the option to rewrite URLs (like on a screenshot above) work only for HTML tag attributes, or it replaces everything it can find? My server which is behind the proxy sends some content in XML, and one of the attributes there is a URL that needs to be rewritten.

Regards,

Roman Toporkov

Rewrite URL to http://www.site.com/Hello -----> http://www.site.com/FolderName/Sample.aspx

$
0
0

Hello guys,

I have for example following website

http://thisismywebsite.com/A/B/test.aspx or http://thisismywebsite.com/A/B/test.html

How can I use URL rewrite module within IIS ? Or How do I setup rewrite Rule ? 

I want to make rewrite or redirect URL to be some thing like this IF I go to http://thisismywebsite.com/Hello then I want to be able to go to http://thisismywebsite.com/A/B/test.aspx , How Can I do this.

So basically I want to create Short Link / Friendly URL or / that does above

Please provide me instruction or snippet code that does above.

Thank you very much

maxmax

subfolder to subdomain help .....

$
0
0

hi:

     Is it possible to rewrite something like this:

https://www.domain.com/a/ to https://a.domain.com/  (eg. d:\www\a)
https://www.domain.com/a/b/c to https://a.domain.com/b/c  (eg. d:\www\a\b\c)

     and 

http://www.domain.com/a/b.php?info=c&test=d to http://a.domain.com/b.php?info=c&test=d 
(eg. d:\www\a\b.php)
http://www.domain.com/a/b/c.php?info=c&test=d to http://a.domain.com/b/c.php?info=c&test=d 
(eg. d:\www\a\b\c.php)

thanks for everyone!

URL Rewrite not working properly

$
0
0

Hello people,

I am a total newbie when it comes to URL rewrite (i am starting to believe i am a total newbie in general) and i have a problem with a URL rewrite rule i am trying to create.

So, we have this site url, let's say   

mysite.com/items.aspx?category_name=test&category_id=1 which i am trying to rewrite like

mysite.com/items/test/1

Following iis.learn tutorial (pretty straightforward) i made a rule to enable user-friendly url adding

www.mysite.com/items.aspx?category_name=test&category_id=1 as the example of the internal url and selected the appropriate option for the url the web visitors see. I also created the corresponding redirect and outbound rewrite rules.

Friendly url works just fine, but that's where my problems start. When i try to access any other page from the one that has the friendly url i get a url that looks like thiswww.mysite.com/items/test/1/default (if i try to access the default page for example)

H have no idea where to begin to search for the problem. I am confused by the countless url rewrite "tutorials" out there that have managed to make me even more confused instead of helping me. I have started to think my problem lies on the website code(the website is not mine, i "inherited" it from a friend who was working on the same position i am atm) but before trying to make out what is wrong in the code i hoped to find an alternative solution.

Thanks in advance to anyone who bothers checking this, it would be a big help if you could point me on the right direction!

Images ,Links and scripts not working after url rewriting

$
0
0

I have write the code  for inbound url but images ,styles and scripts are lost

<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^([0-9]+)/([_0-9a-z-]+)" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="productdescription.asp?id={R:1}&amp;title={R:2}" />
</rule>


IIS URL Rewrite rule - test works but no results

$
0
0

I’m having trouble writing a URL Rewrite rule for IIS 8.5. My expertise writing rules is barely intermediate, and the documentation has not been helpful.

I’m trying to redirect the following URL:

hostname.com/sub1/sub2/sub3/sub4

to this URL:

hostname.com/sub1/sub6/sub7/sub2/sub4

And by that, I mean —

* hostname.com is a variable. There are multiple hostnames served by this single .NET application.
* sub1 stays the same and is not a variable.
* sub2 is the sub that should trigger the pattern and is not
a variable, however it gets moved to a different place in the URL.
* Given the previous two points, I assume the string ‘sub1/sub2’
should be hardcoded into the pattern to identify the URLs to
transform and to avoid redirect loops.
* sub3 gets deleted.
* sub4 is a variable.
* sub6 and sub7 are not variables.

I know I'm using the term variable incorrectly - what I mean by variable is that those parts of the URL change and need to be captured and used as back references.

Let me clarify with an example:

https://hostname.com/application/catalog/v3g5h6j8k9/feline-footwear

to ->

https://hostname.com/application/showcase/default/catalog/feline-footwear

All my attempts at writing a rule failed. I’m sure I’m doing everything wrong.

I thought I got close with this. The pattern tests all succeeded, but it would not pick up the incoming URL. I just get a 404:

<rule name=“Catalog redir” enabled=“true” stopProcessing="true">
<match url=“^(.*)/application/catalog/(.*)/(.*)” />
<action type="Redirect" url=“{R:1}/application/showcase/default/catalog/{R:3}” redirectType="SeeOther" />
</rule>

I’ve also tried using ([a-zA-Z0-9_+-]+) instead of (.*)

Also, I have this rule installed at the /application level of the tree, not the root. Could this be incorrect? Or better posed, how does the location of the rule in the web site tree correlate to the pattern? I couldn't find that in the docs either.

Thanks in advance for any advice.

502 error when rewriting HTTPS site

$
0
0

Hi all,

I really could use some help from the experts out there...

We use a reverse proxy to publish some http sites to the outside world, all are running fine.

Now I need to give access to an internal HTPPS site.

- internal site is accessible from the server running urlrewrite (30), all certifcates are OK, no errors
- certificate for the external url is installed on the urlrewrite server
- certificate is bound to the specific webserver.

I have copied the simple basic rule I use for my HTTP sites


        <rewrite>
            <rules>
                <rule name="ReverseProxyInboundRule1" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
                    <match url="*" />
                    <conditions>
                        <add input="{HTTPS}" pattern="On" />
                    </conditions>
                    <action type="Rewrite" url="https://vm-tobadata.azo.lan/{R:0}" />
                </rule>
            </rules>
        </rewrite>

When using this setup, I'm getting an error "502 - Webserver received an invalid response while acting as a gateway or proxy server"

I have enabled failed request tracing, capturing 502 errors, but this isn't helping me, since it seems that the rewrite rule works as expected?

1. GENERAL_REQUEST_START SiteId="2", AppPoolId="ess", ConnId="1610612741", RawConnId="0", RequestURL="https://ess.azoudenaarde.be:443/", RequestVerb="GET" 14:36:04.272
2. GENERAL_ENDPOINT_INFORMATION RemoteAddress="77.109.122.130", RemotePort="53751", LocalAddress="192.168.1.80", LocalPort="443" 14:36:04.288
3. GENERAL_REQUEST_HEADERS Headers="Connection: Keep-Alive
Accept: text/html, application/xhtml+xml, image/jxr, */*
Accept-Encoding: gzip, deflate
Accept-Language: nl-BE
Host: ess.azoudenaarde.be
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
" 14:36:04.288
4. GENERAL_GET_URL_METADATA PhysicalPath="", AccessPerms="513" 14:36:04.288
5. HANDLER_CHANGED OldHandlerName="", NewHandlerName="StaticFile", NewHandlerModules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule", NewHandlerScriptProcessor="", NewHandlerType="" 14:36:04.288
6. URL_REWRITE_START RequestURL="/", Scope="Distributed", Type="Inbound" 14:36:04.288
7. RULE_EVALUATION_START RuleName="ReverseProxyInboundRule1", RequestURL="", QueryString="", PatternSyntax="Wildcard", StopProcessing="true", RelativePath="/" 14:36:04.288
8. PATTERN_MATCH Pattern="*", Input="", Negate="false", Matched="true" 14:36:04.288
9. CONDITIONS_EVALUATION_START LogicalGrouping="MatchAll" 14:36:04.288
10. CONDITION_EVALUATION Input="{HTTPS}", ExpandedInput="on", MatchType="Pattern", Pattern="On", Negate="false", Succeeded="true" 14:36:04.288
11. CONDITIONS_EVALUATION_END Succeeded="true" 14:36:04.288
12. REWRITE_ACTION Substitution="https://vm-tobadata.azo.lan/{R:0}", RewriteURL="https://vm-tobadata.azo.lan/", AppendQueryString="true", LogRewrittenURL="false" 14:36:04.288
13. RULE_EVALUATION_END RuleName="ReverseProxyInboundRule1", RequestURL="https://vm-tobadata.azo.lan/", QueryString="", StopProcessing="true", Succeeded="true" 14:36:04.288
14. GENERAL_SET_REQUEST_HEADER HeaderName="X-Original-URL", HeaderValue="/", Replace="true" 14:36:04.288
15. URL_CHANGED OldUrl="/", NewUrl="https://vm-tobadata.azo.lan/" 14:36:04.288
16. URL_REWRITE_END RequestURL="https://vm-tobadata.azo.lan/" 14:36:04.288
17. USER_SET AuthType="", UserName="", SupportsIsInRole="true" 14:36:04.288
18. HANDLER_CHANGED OldHandlerName="StaticFile", NewHandlerName="ApplicationRequestRoutingHandler", NewHandlerModules="ApplicationRequestRouting", NewHandlerScriptProcessor="", NewHandlerType="" 14:36:04.288
19. GENERAL_SET_REQUEST_HEADER HeaderName="Max-Forwards", HeaderValue="10", Replace="true" 14:36:04.288
20. GENERAL_SET_REQUEST_HEADER HeaderName="Host", HeaderValue="vm-tobadata.azo.lan", Replace="true" 14:36:04.288
21. GENERAL_SET_REQUEST_HEADER HeaderName="X-Forwarded-For", HeaderValue="77.109.122.130:53751", Replace="true" 14:36:04.288
22. GENERAL_SET_REQUEST_HEADER HeaderName="X-ARR-SSL", HeaderValue="4096|256|C=IL, O=StartCom Ltd., OU=StartCom Certification Authority, CN=StartCom Class 2 IV Server CA|C=BE, S=Oost-Vlaanderen, L=Ronse, SN=De Meyer, G=Tim, CN=ess.azoudenaarde.be", Replace="true" 14:36:04.288
23. GENERAL_SET_REQUEST_HEADER HeaderName="X-ARR-ClientCert", HeaderValue="", Replace="true" 14:36:04.288
24. GENERAL_SET_REQUEST_HEADER HeaderName="X-ARR-LOG-ID", HeaderValue="075dbaec-f845-4e32-985d-3761117ba9ad", Replace="true" 14:36:04.288
25. GENERAL_SET_REQUEST_HEADER HeaderName="Connection", HeaderValue="", Replace="true" 14:36:04.288
26. URL_CHANGED OldUrl="https://vm-tobadata.azo.lan/", NewUrl="/" 14:36:04.303
27. GENERAL_SEND_CUSTOM_ERROR HttpStatus="502", HttpSubStatus="3", FileNameOrURL="502.htm" 14:36:05.366
28. GENERAL_SET_RESPONSE_HEADER HeaderName="Content-Type", HeaderValue="text/html", Replace="true" 14:36:05.381
29. GENERAL_FLUSH_RESPONSE_START  14:36:05.381
30. GENERAL_RESPONSE_HEADERS Headers="Content-Type: text/html
Server: Microsoft-IIS/8.5
" 14:36:05.381
31. GENERAL_RESPONSE_ENTITY_BUFFER Buffer="<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>502 - Web server received an invalid response while acting as a gateway or proxy server.</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
fieldset{padding:0 15px 10px 15px;}
h1{font-size:2.4em;margin:0;color:#FFF;}
h2{font-size:1.7em;margin:0;color:#CC0000;}
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
background-color:#555555;}
#content{margin:0 0 0 2%;position:relative;}
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
 <div class="content-container"><fieldset>
  <h2>502 - Web server received an invalid response while acting as a gateway or proxy server.</h2>
  <h3>There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.</h3>
 </fieldset></div>
</div>
</body>
</html>
" 14:36:05.381
32. GENERAL_FLUSH_RESPONSE_END BytesSent="1616", ErrorCode="The operation completed successfully.
 (0x0)" 14:36:05.381
33. GENERAL_REQUEST_END BytesSent="1616", BytesReceived="266", HttpStatus="502", HttpSubStatus="3" 14:36:05.381

Getting 404-access is denied page not found error after URl rewrite process.

$
0
0

Hello All,

I have used the URL rewrite feature for site level. I have almost tried by creating blank rules,User_Friendly and rewrite map but every time i am getting 404- access is denied error.

can you please suggest.

thanks,

Shiv

Rewriting URLs for static content appears to prevent static caching

$
0
0

Hi,

I have setup a new instance of IIS (actually in the form of an Azure Web App) with the following URL rewrite rule in web.config:

<rewrite><rules><rule name="StaticContent"><action type="Rewrite" url="public{REQUEST_URI}"/></rule></rules></rewrite>

The premise is that all requests to the site for static files are redirected to a 'public' subfolder and served from there. This seems to work and the appropriate file is served properly.

However, enabling Detailed Error output for the Web App (for another reason) has revealed a 404 error that appears to occur for every static file request. The error file output is an 404 error page, and I'm not familiar enough with the internal workings of IIS to know why this is created and yet the request still actually succeeds. I've attached an image of the error page, but notice that the path is "/scripts/..." and "wwwroot\scripts\.." without the 'public' prefix that should have been written in.

I performed a failed request trace and found that an error was occurring at FILE_CACHE_ACCESS_START which seems like it might have been the cause. I've attached an image of this section.
Note that the file path is also missing the 'public' prefix, even though the rewrite module ran successfully earlier on in the trace.

--

At this point in typing this post, I discovered that after the rewrite module begins, it creates a child request so that the module order is as follows in the trace:

NOTIFY_MODULE_START: RewriteModule
 - test rewrite rules -

GENERAL_CHILD_REQUEST_START (using RequestURL with the rewritten url)
 - perform full request -
GENERAL_CHILD_REQUEST_END

NOTIFY_MODULE_END: RewriteModule
- continue with the rest of the initial request using the incorrect un-rewritten URL -

And this last part is where the error occurs in FILE_CACHE_ACCESS_START.

So my final question is now: How do we prevent this initial request for the un-rewritten URL?

SAML redirection not working for URL Write reverse proxy

$
0
0

Hi,

I have a website which I'm reverse proxying behind a Windows 2012R2 with IIS, ARR, and URL Rewrite.  The defined rules work and the website is available through the reverse proxy, however if you try to use SAML authentication it fails when you click on SSO link the reverse proxy is rewriting the returned redirection URL to be the name of the website.

The website name is files.company.com, and SAML is provided by Okta. When the SSO link is clicked on the website it will return a 302 redirect to us.okta.com/app/company/ssp, however, the reverse proxy is rewriting the redirect back to files.company.com/app/company/ssp

I have enabled Failed Request Tracing and it show that the URL Rewrite is processed on the inbound request and shows that the response from the website is not changed by the rewrite rules, or at least from what I can tell, it's changed instead by the GENERAL_SET_RESPONSE_HEADER, which I'm assuming is part of ARR, even with all the tracing option turned on I don't see anymore information.  The log looks like this:

URL rewrite start

Inbound rule rewrite request

URL Rewrite end

Module_set_response_success_status - ARR, 302, moved temporarily

General_Set_Response_Header - cache-control, no-cache, replace = true

General_Set_Response_Header - pragma, no-cache, replace = true

General_Set_Response_Header - Content-type, text/html, replace = true

General_Set_Response_Header - expires, <date>, replace=true

General_Set_Response_Header - location, https://us.okta.com/app/company/ssp, replace=true

General_Set_Response_Header - x-frame-options,, sameorigin, replace=false

General_Set_Response_Header - x-xss=protection, 1;mode=block, replace=true

General_Set_Response_Header - strict-transport-security, option, replace=false

General_Set_Response_Header - location, https://files.company.com/app/company.ssp, replace= true

Can anyone let me know if it is possible to exclude certain URL from being modified that are returned by the IIS server?

Thanks in advance,

Gary. 

Viewing all 2482 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>