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”) ==”changeme.com” ){
redirect(url: “http://www.changeme.com”)
}
}
}
}
ProsperaSoft offers Grails development solutions. You can email at info@prosperasoft.com to get in touch with ProsperaSoft Grails experts and consultants.