2017-02-13 3 views
0

내가 않는 htaccess로 파일을 만들려고 해요 다음 :방법의 .htaccess를 통해 EC2 상태 검사를 허용하는

1은 EC2 상태 확인 URL이 https를 로 리디렉션없이 타격을받을 수 있습니다 2 https가 아닌 모든 트래픽을 https로 리디렉션 3/to/auth/app/public/app (https를 사용)로 리디렉션

항목 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의^상태 검사와 노력하겠다고