Заказ закрыт
Почему IIS переадресует (Rewrite) HTTPS запрос на порт 80?

Бюджет: 500 руб
5.95 $ – 5.14 €
Требуется помощь в том, чтобы разобраться с Microsoft Azure по следующему вопросу (подробнее на toster.ru/q/178687)

Идея в том, чтобы перенаправлять все прямые попытки скачать файл на специальный адрес: mysite.com/getfile/?fname...
Трудности отладки rewrite в Azure, не позволяют мне докопаться до истины. Может быть Вы сможете заметить где грабли?

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
    <staticContent>
      <remove fileExtension=".woff" />
      <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
            <remove fileExtension=".ttf" />
            <mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
            <remove fileExtension=".svg" />
            <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
            <remove fileExtension=".gif" />
            <mimeMap fileExtension=".gif" mimeType="image/gif" />
      <remove fileExtension=".jpg" />
            <mimeMap fileExtension=".jpg" mimeType="image/jpg" />
            <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="0.01:00:00" />
      </staticContent>
        <urlCompression doStaticCompression="true" />
    <rewrite>
      <rules>
        <clear />
                          
                <rule name="Redirect to https" stopProcessing="true" enabled="true">
                    <match url="(.*)" />
          <conditions logicalGrouping="MatchAny">
            <!--<add input="{SERVER_PORT_SECURE}" pattern="^1$" />
            <add input="{SERVER_PORT_SECURE}" pattern="^0$" />-->
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="true" />
                </rule>
          
        <rule name="Redirect to non-www1" stopProcessing="true" enabled="true">
          <match url="(.*)" negate="false" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^mysite\.com$" negate="true" ignoreCase="true" />
          </conditions>
          <action type="Redirect" url="mysite.com/{R:1}" redirectType="Permanent" />
        </rule>
        
        <!--
        Этот блок должен всегда выполняться при попытке прямого доступа в папку /media/upload/users/
        но IIS почему-то перенаправляет запросы неправильно, и результирующий всегда выглядит как
        mysite:80/media/upload/us...
        и на странице показывает ошибку 404.4
        Проблема в том, что HTTPS это порт 443.
        -->
        <rule name="Rewrite to getfile" stopProcessing="true" enabled="false">
                    <match url="^media\/upload\/users\/(.*)$" />
          <action type="Rewrite" url="//getfile/?fname=media/upload/users/{R:1}" />
                </rule>
        
        <rule name="Imported Rule 1" enabled="true">
          <match url="^(.*)$" ignoreCase="false" />
            <conditions>
              <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
              <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
              <add input="{R:1}" pattern="^(index.php|robots.txt)" ignoreCase="false" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.php/{R:0}" />
        </rule>
        
        <rule name="Imported Rule 2" stopProcessing="true" enabled="true">
          <match url="^(application|modules|system)" ignoreCase="false" />
            <conditions>
              <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.php/{R:0}" />
        </rule>
        
      </rules>
    </rewrite>
  </system.webServer>
    <connectionStrings>
        <add connectionString="database=mydb;server=mydbserver;uid=username;pwd=password" name="dbname" providerName="MySql.Data.MySqlClient" />
    </connectionStrings>
</configuration>
Опубликован 02.02.2015 в 14:30
Заказ находится в архиве

Выберите способ верификации:

Обновите страницу после прохождения верификации.