How to always set “www” in grailsUrl?


To always set “www” in grailsUrl, we have to create filter. Following is the example :

class HostFilters {

def filters = {
all(controller:’*’, action:’*’) {
before = {
if(request.getHeader(“host”) ==”” ){

redirect(url: “”)



ProsperaSoft offers Grails development solutions. You can email at to get in touch with ProsperaSoft Grails experts and consultants.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>