2017-02-13 1 views
0

私はありません.htaccessファイルを作成しようとしている以下:はどのように.htaccessファイルを通じてEC2のヘルスチェックを可能にする

1は、EC2のヘルスチェックURLがhttps にリダイレクトせずに打つことができるようにします2 https以外のすべてのトラフィックをhttpsにリダイレクト 3 httpsを使用して/ to/auth/app/public/appにリダイレクトする

項目2と3はうまく動作しますが、ヘルスチェックは失敗し、サーバは応答しなくなります。ここに私の.htaccessファイルの内容は次のとおりです。

RewriteEngine On 

#one attempt that didn't work 
#RewriteCond %{HTTP_HOST} !^my\.domain\.com$ [NC] 
#RewriteCond %{REQUEST_URI} !^/healthcheck.html$ 
#RewriteRule^http://my.domain.com/$1 [R=301,L] 

#another attempt that didn't work 
#RewriteCond %{HTTP_HOST} !$ [NC] 
#RewriteCond %{REQUEST_URI} !^/healthcheck.html$ 
#RewriteRule ^(.*)$ /$1 [L,QSA] 

#this works 
RewriteRule ^$ https://my.domain.com/auth/app/public/app/ [L] 

#this works 
RewriteCond %{HTTP:X-Forwarded-Proto} !https 
RewriteRule^https://my.domain.com%{REQUEST_URI} [L] 

最初の二つはコメントアウトされた試みは、私がhttps://serverfault.com/questions/470015/how-should-i-configure-my-elb-health-check-when-using-namevirtualhosts-and-redirhttps://serverfault.com/questions/470015/how-should-i-configure-my-elb-health-check-when-using-namevirtualhosts-and-redir/597541#597541

で発見例からあなたは私が得ることができるどのように任意の提案を持っているなら、私に知らせてくださいますこの作業。

+0

\ .htmlを$:ここに私の.htaccessファイルの作業バージョンです何も書き換えない( ' - ')、これを最後のルールにする。追加のRewriteCondsは必要ありません。 – CBroe

答えて

0

ありがとうございます。私がそれを読む前に、私のために働いている解決策を提供した別の記事を見つけました。私は、URLが自分のヘルスチェックページのものであれば、httpsリダイレクトルールを適用しないという条件を追加しました。 [L] ` - - 要求されたURLは` healthcheck.html`その後、

RewriteEngine On 
RewriteRule ^$ https://my.domain.com/auth/app/public/app/ [L] 

RewriteCond %{HTTP:X-Forwarded-Proto} !https 
RewriteCond %{REQUEST_URI} !^/healthcheck\.html$ 
RewriteRule^https://my.domain.com%{REQUEST_URI} [L] 
は、私はシンプルな `のRewriteRule ^ヘルスで試してみた
関連する問題