2016-06-24 7 views
0

強制的にHTTPS経由でルーティングしたいです。これを追加するには、Azureのsaysをルーティングを強制するためにAzureで展開されたLaravel WebアプリケーションのHTTPSルーティング

<configuration> 
    <system.webServer> 
    <rewrite> 
     <rules> 
     <rule name="Imported Rule 1" stopProcessing="true"> 
      <match url="^(.*)/$" ignoreCase="false" /> 
      <conditions> 
      <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> 
      </conditions> 
      <action type="Redirect" redirectType="Permanent" url="/{R:1}" /> 
     </rule> 
     <rule name="Imported Rule 2" stopProcessing="true"> 
      <match url="^" ignoreCase="false" /> 
      <conditions> 
      <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> 
      <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> 
      </conditions> 
      <action type="Rewrite" url="index.php" /> 
     </rule> 
     </rules> 
    </rewrite> 
    </system.webServer> 
</configuration> 

:私は/パブリックフォルダ内の以下のweb.configファイルとAzureのクラウドプラットフォームでWebアプリケーションを持っている

<system.webServer> 
    <rewrite> 
     <rules> 
     <rule name=”Redirect to https”> 
      <match url=”(.*)”/> 
      <conditions> 
       <add input=”{HTTPS}” pattern=”Off”/> 
       <add input=”{REQUEST_METHOD}” pattern=”^get$|^head$” /> 
      </conditions> 
      <action type=”Redirect” url=”https://{HTTP_HOST}/{R:1}”/> 
     </rule> 
     </rules> 
    </rewrite> 
</system.webServer> 

元のweb.configファイルを変更してHTTPSに適合させるにはどうすればよいですか?

は、私はちょうどルールを追加する必要がありました

を解決しました。変更されたウェブ設定は:

<configuration> 
    <system.webServer> 
    <rewrite> 
     <rules> 
     <rule name="Imported Rule 1" stopProcessing="true"> 
      <match url="^(.*)/$" ignoreCase="false" /> 
      <conditions> 
      <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> 
      </conditions> 
      <action type="Redirect" redirectType="Permanent" url="/{R:1}" /> 
     </rule> 
     <rule name="Imported Rule 2" stopProcessing="true"> 
      <match url="^" ignoreCase="false" /> 
      <conditions> 
      <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> 
      <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> 
      </conditions> 
      <action type="Rewrite" url="index.php" /> 
      <rule name=”Redirect to https”> 
      <match url=”(.*)”/> 
      <conditions> 
       <add input=”{HTTPS}” pattern=”Off”/> 
       <add input=”{REQUEST_METHOD}” pattern=”^get$|^head$” /> 
      </conditions> 
      <action type=”Redirect” url=”https://{HTTP_HOST}/{R:1}”/> 
     </rule> 
     </rule> 
     </rules> 
    </rewrite> 
    </system.webServer> 
</configuration> 

答えて

1

私はあなたがLaravel側からこの問題に取り組むことができると信じています。

は、次のルートを考えてみましょう:

Route::get('signin', ['uses' => '[email protected]', 'https']); 

このルートはHTTPSのみを務めます。私はしばらく前にこの状況に対処しなければなりませんでした。

1

あなたlaravelアプリケーションのディレクトリ構造が似ている場合:あなたが直接あなたのアプリケーションのルートディレクトリにあるコンテンツのファイルweb.configを作成することができます

wwwroot/ 
    app/ 
    public/ 
    ... 
    .env 
    ... 

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
    <rewrite> 
     <rules> 
     <rule name="Redirect to https"> 
      <match url="(.*)"/> 
      <conditions> 
       <add input="{HTTPS}" pattern="Off"/> 
       <add input="{REQUEST_METHOD}" pattern="^get$|^head$" /> 
      </conditions> 
      <action type="Redirect" url="https://{HTTP_HOST}/public/{R:1}"/> 
     </rule> 
     </rules> 
    </rewrite> 
</system.webServer> 
</configuration> 

がすべてのリダイレクトしますHTTPSにHTTP要求を送信し、パブリックフォルダにリダイレクトします。

さらに詳しいことがありましたら、お気軽にお知らせください。

関連する問題