On 28 April 2016 at 18:21, jieryn <jie...@gmail.com> wrote:
> You can get the same effect using standard web.xml fragment and
> without a 3rd party dependency:
>
>
>   <security-constraint>
>     <web-resource-collection>
>       <web-resource-name></web-resource-name>
>       <url-pattern>/*</url-pattern>
>     </web-resource-collection>
>     <user-data-constraint>
>       <transport-guarantee>CONFIDENTIAL</transport-guarantee>
>     </user-data-constraint>
>   </security-constraint>

Hi, and thanks for taking the time to reply.

Unfortunately, rather than solving the problem it *is* the problem (as
far as I can figure out anyway)
If I take the rewrite filter out of the picture the configuration I
have is as follows

web.xml

<security-constraint>
     <web-resource-collection>
       <web-resource-name></web-resource-name>
       <url-pattern>/*</url-pattern>
     </web-resource-collection>
     <user-data-constraint>
       <transport-guarantee>CONFIDENTIAL</transport-guarantee>
     </user-data-constraint>
</security-constraint>

server.xml


     <Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="443" />

    <Connector port="443" maxThreads="150" scheme="https" secure="true"
               SSLEnabled="true" keystoreFile="/opt/keys/tomcat.keystore"
               keystorePass="*********" clientAuth="false"
keyAlias="tomcat" sslProtocol="TLS" />



stop tomcat
clear out all the logs
start tomcat
rebuild and redeploy the web app

root@sandbox:/tmp# curl -D /tmp/headers.txt -s  http://localhost/sitemap.xml

root@sandbox:/tmp# cat headers.txt
HTTP/1.1 302 Found
Server: Apache-Coyote/1.1
Cache-Control: private
Expires: Thu, 01 Jan 1970 01:00:00 GMT
Location: https://localhost/sitemap.xml
Content-Length: 0
Date: Fri, 29 Apr 2016 06:55:39 GMT

Remember, the filter is out of the picture yet still I get a 302

If I can't solve this it will be a show stopper and I'll have to go
back to straight http which will push my link further down the Google
search results.

Thanks
lyallex

>
>
> On Thu, Apr 28, 2016 at 1:12 PM, Lyallex <lyal...@gmail.com> wrote:
>> apache-tomcat-7.0.42
>> jdk1.8.0_77
>> CentOS Linux 7.2.1511
>> urlrewritefilter-4.0.3.jar
>>
>> I'm using the rewrite filter from http://tuckey.org/urlrewrite/
>>
>> I have a rule, it's supposed to 301 perm-redirect from http to https
>>
>>   <rule>
>>        <name>seo redirect</name>
>>        <condition name="host" 
>> operator="notequal">^www.example.com</condition>
>>        <condition name="host" operator="notequal">^localhost</condition>
>>        <from>^/(.*)</from>
>>        <to type="permanent-redirect" 
>> last="true">https://www.example.com/$1</to>
>>     </rule>
>>
>> The problem is despite setting the to-type to permanent-redirect I'm
>> actually getting a 302 temporary-redirect.
>>
>> I know this is probably off topic but if anyone has any experience of
>> this I'd be gratefull to hear how you solved it
>>
>> Thanks
>>
>> lyallex
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to