简体   繁体   中英

IIS URL Rewrite : 403 - Forbidden: Access is denied

I installed IIS URL Rewrite 2.0 and add a rule to redirect all http links to https. Here is my Web.Config Code:

 <rewrite>
        <rules>
            <rule name="REdirect To HTTPS" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTPS}" pattern="^OFF$" />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
            </rule>
        </rules>
    </rewrite>

Everything looks fine. But when I access my website using http, it throws 403 error.

403 - Forbidden: Access is denied.
You do not have permission to view this directory or page using the credentials that you supplied.

TLS 1.0 is enabled with IIS 7.5.

Where I can get more info on exactly what type of 403 error it is?

SSL was enabled in IIS. I just read somewhere that in SSL Settings Require SSL need to be unchecked when using URL Rewrite 2.0.

I deselect the Require SSL and click Apply. Its working fine now.

I was getting the same error; here was my solution, in case it helps others.

My rule was rewriting URLs coming in to the Default Web Site's root application ("/") to "/public", but I was getting a 403 error. The "/public" application worked fine if I requested it directly, and it also worked fine if I disabled the rewrite rule, so permissions there were not the issue.

"Require SSL" was not checked, as noted in an earlier answer.

Looking at the IIS log file, I found that the specific flavor of error was 403.18 - "Cannot execute requested URL in the current application pool".

The web site's root application needs to be assigned the same application pool as the application you're sending the request to.

不确定这是否有帮助,但我看到您的规则未启用

<rule name="Redirect to https" enabled="false" stopProcessing="true">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM