Redirecting HTTP to HTTPS in Confluence not working, what did I miss?
Asked by Paul Vreugdenhil:

I have followed the directions to run Confluence over SSL (<https://confluence.atlassian.com/doc/running-confluence-over-ssl-or-https-161203.html>) and I can't get the redirect to work. In my server.xml file I have:

```
<Connector port="80" connectionTimeout="20000" redirectPort="8443"
maxThreads="200" minSpareThreads="10"
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"
protocol="org.apache.coyote.http11.Http11NioProtocol"/>
```

and

```
<Connector port="8443" maxHttpHeaderSize="8192"
maxThreads="200" minSpareThreads="25"
protocol="org.apache.coyote.http11.Http11Nio2Protocol"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLSv1.2" sslEnabledProtocols="TLSv1.2" SSLEnabled="true"
URIEncoding="UTF-8" keystorePass="changeit" keystoreFile="C:\Program Files\Atlassian\confluence.keystore"/>
```

In my web.xml file I added:

```
<security-constraint>
<web-resource-collection>
<web-resource-name>Restricted URLs</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport_guarantee>CONFIDENTIAL</transport_guarantee>
</user-data-constraint>
</security-constraint>
```

I restarted Confluence and now I can access with HTTP and I can access with HTTPS but HTTP is not redirecting to HTTPS. Can you tell me what I have missed?


Answers:
author: Paul Vreugdenhil
body: I found my own problem. I had

```
<transport_guarantee>
```

instead of

```
<transport-guarantee>
```

comments: author: Brant Schroeder
body: Great


author: Brant Schroeder
body: The only thing that I can see is your URL pattern is /\* instead of / as in the documentation. /\* on a servlet overrides all other servlets while / doesn't override any other servlet. Both should technically redirect but you might make the change and see if that resolves your issue.

comments: author: Paul Vreugdenhil
body: I did try using the / as in the documentation but that also did not work. I tried using /\* based on a suggestion in another community thread. It is as if the web.xml code I added is being ignored.


author: Brant Schroeder
body: Paul,

Is the \<security-constraint\> before end of web.xml file just above: \</web-app\> ?


author: Paul Vreugdenhil
body: Yes. The end of my web.xml file looks like this:

```
<error-page>
<exception-type>com.atlassian.sal.api.permission.NotAuthenticatedException</exception-type>
<location>/login.action</location>
</error-page>
<error-page>
<exception-type>com.atlassian.sal.api.permission.AuthorisationException</exception-type>
<location>/notpermitted.action</location>
</error-page>

<!-- http redirect to https --> 
<security-constraint>
<web-resource-collection>
<web-resource-name>Restricted URLs</web-resource-name>
<url-pattern>/</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport_guarantee>CONFIDENTIAL</transport_guarantee>
</user-data-constraint>
</security-constraint>
</web-app>
```


author: Brant Schroeder
body: What is your base url and do you have proxy setup?


author: Paul Vreugdenhil
body: My server base url in the Confluence General Configuration is in the format <https://domain.name.com>. I don't have a proxy setup. Apart from trying to set-up SSL, I have a new stock Confluence install.


Tags: confluence-server

server