0

I have Grails 2.5.6 application using Spring Security Grails plugin and there is a filter in the application to check something if exists continue normally if not must go to the controller Country, action countryAndCity , the URL before accessing the filter is https://localhost:8443/MyApp/login/auth after executing the filter the redirect URL is http://localhost:8080//countries/countryAndCity,

What is making this strange behavior in the URLs? below are the 2 filters executing in this phase :

SwitchToHTTPSFilters:

def filters = {

    // to redirect to HTTPS for the below actions
    all(controller: 'users|login|countries', action: 'create|auth|*', actionExclude: 'logout') {
        before = {


            if (!request.isSecure()) {
           def url = "https://" + request.serverName + ':8443' + request.forwardURI

                redirect(url: url, permanent: true)
                return false
            }
        }
        after = {Map model ->
        }
        afterView = {Exception e ->
        }
    }
}

SetCountryAndCityFirstFilters:

// for the Users controller set country and city first
 def filters = {
    all(controller: 'users', action: 'create') {
        before = {
            if (session.countryAndCity == null) {      
                session.forwardToURI = request.forwardURI
                redirect(controller: "countries", action: "countryAndCity")
            }
        }
        after = {Map model ->
        }
        afterView = {Exception e ->
        }
    }
}
SShehab
  • 1,039
  • 3
  • 17
  • 31

0 Answers0