(Quick Reference)

16 Channel Security - Reference Documentation

Authors: Burt Beckwith, Beverley Talbott

Version: 2.0.0

16 Channel Security

Use channel security to configure which URLs require HTTP and which require HTTPS.

PropertyDefault ValueMeaning
portMapper.httpPort8080HTTP port your application uses.
portMapper.httpsPort8443HTTPS port your application uses.
secureChannel.definitionnoneMap of URL pattern to channel rule

Build a Map under the secureChannel.definition key, where the keys are URL patterns, and the values are one of REQUIRES_SECURE_CHANNEL, REQUIRES_INSECURE_CHANNEL, or ANY_CHANNEL:

grails.plugin.springsecurity.secureChannel.definition = [
   '/login/**':         'REQUIRES_SECURE_CHANNEL',
   '/maps/**':          'REQUIRES_INSECURE_CHANNEL',
   '/images/login/**':  'REQUIRES_SECURE_CHANNEL',
   '/images/**':        'ANY_CHANNEL'
]

URLs are checked in order, so be sure to put more specific rules before less specific. In the preceding example, /images/login/** is more specific than /images/**, so it appears first in the configuration.

Header checking

The default implementation of channel security is fairly simple; if you're using HTTP but HTTPS is required, you get redirected to the corresponding SSL URL and vice versa. But when using a load balancer such as an F5 BIG-IP it's not possible to just check secure/insecure. In that case you can configure the load balancer to set a request header indicating the current state. To use this approach, set the useHeaderCheckChannelSecurity configuration property to true and optionally change the header names or values:

grails.plugin.springsecurity.secureChannel.useHeaderCheckChannelSecurity = true

By default the header name is "X-Forwarded-Proto" and the secure header value is "http" (i.e. if you're not secure, redirect to secure) and the insecure header value is "https" (i.e. if you're secure, redirect to insecure). You can change any or all of these default values though:

grails.plugin.springsecurity.secureChannel.secureHeaderName = '...'
grails.plugin.springsecurity.secureChannel.secureHeaderValue = '...'
grails.plugin.springsecurity.secureChannel.insecureHeaderName = '...'
grails.plugin.springsecurity.secureChannel.insecureHeaderValue = '...'