Grails 2.5.6 странные фильтры поведения - PullRequest
0 голосов
/ 24 июня 2019

У меня есть Grails 2.5.6 приложение, использующее Spring Security Grails plugin, и в приложении есть фильтр для проверки чего-либо, если существует, продолжайте нормально, если нет, необходимо перейти к контроллеру Country, действие countryAndCity, URL перед доступом к фильтру. равно https://localhost:8443/MyApp/login/auth после выполнения фильтра URL перенаправления равен http://localhost:8080//countries/countryAndCity,

Что делает это странное поведение в URL? ниже приведены 2 фильтра, выполняющиеся на этом этапе:

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 ->
        }
    }
}
...