我正在尝试将所有http请求重定向到https,但“health.html”除外,我需要在端口80上通过标准http提供服务;出于某种原因,下面的规则似乎没有这样做 - 我确信这是一种语法...
思想?
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN" "http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">
<urlrewrite>
<rule match-type="regex">
<note>
Redirect all http requests to https except health.html for EB monitoring
</note>
<condition type="header" operator="equal" name="X-Forwarded-Proto">^HTTP$</condition>
<condition name="request-uri" operator="notequal">^/health.html(.*)$</condition>
<from>^.*$</from>
<to type="permanent-redirect" last="true">https://%{server-name}%{request-uri}</to>
</rule>
<rule>
<note>
Allow TomCat to have SES links.
</note>
<condition type="request-uri" operator="notequal">\.(bmp|gif|jpe?g|png|css|js|txt|pdf|doc|xls|cfc|ico|php|asp)$</condition>
<condition type="request-uri" operator="notequal">^/railo-context(.*)$</condition>
<condition type="request-uri" operator="notequal">^/flex2gateway(.*)$</condition>
<condition type="request-uri" operator="notequal">^/jrunscripts(.*)$</condition>
<condition type="request-uri" operator="notequal">^/cfide(.*)$</condition>
<condition type="request-uri" operator="notequal">^/cfformgateway(.*)$</condition>
<condition type="request-uri" operator="notequal">^/files(.*)$</condition>
<condition type="request-uri" operator="notequal">^/images(.*)$</condition>
<condition type="request-uri" operator="notequal">^/javascripts(.*)$</condition>
<condition type="request-uri" operator="notequal">^/miscellaneous(.*)$</condition>
<condition type="request-uri" operator="notequal">^/stylesheets(.*)$</condition>
<condition type="request-uri" operator="notequal">^/favicon.ico(.*)$</condition>
<condition type="request-uri" operator="notequal">^/robots.txt(.*)$</condition>
<condition type="request-uri" operator="notequal">^/sitemap.xml(.*)$</condition>
<condition type="request-uri" operator="notequal">^/rewrite.cfm(.*)$</condition>
<condition type="request-uri" operator="notequal">^/health.html(.*)$</condition>
<condition type="request-uri" operator="notequal">^/public(.*)$</condition>
<from>^/(.*)$</from>
<to type="passthrough" last="true">/rewrite.cfm/$1</to>
</rule>
</urlrewrite>
答案 0 :(得分:4)
我是个白痴。
<condition name="request-uri" operator="notequal">
应该是
<condition type="request-uri" operator="notequal">
叹息。