简体   繁体   中英

Grails 3.3.10 urlmapping doesn't work anymore

I just update my app to grails 3.3.10. It's a simple app that use spring security 3.2.3. My url map is this:

class UrlMappings {

    static mappings = {
        "/$controller/$action?/$id?(.$format)?" {
            constraints {
                // apply constraints here
            }
        }

        "/"(controller: "home", action: "index")
        "500"(controller: "error", action: "error500", [params: params])
        "404"(view: '/error/notFound')
    }
}

after update from 3.3.9 to 3.3.10 the / is not anymore redirect to home controller. If I roll back it then it works again. Documentation on grails web site has a broken link for 3.3.10 version. They change something or it sounds to me it's a bug. Any ideas?

UPDATE thanks to @MiloBen I did a step forward, and now I it seems to be redirect to home but now I got a 403 in the home page. Let me recap. My UrlsMapping.groovy is the same, see above. My application.groovy is this now:

[pattern: '/', access: ['permitAll']],
[pattern: '/error', access: ['permitAll']],
[pattern: '/login/**', access: ['permitAll']],
[pattern: '/assets/**', access: ['permitAll']],
[pattern: '/home/**', access: ['permitAll']]

I cannot figure out what is the problem now, it seems permitAll should kick in and let me see my home page /home, which is redirected in / by the UrlMapping.

I had similar issue.

In the file grails-app/conf/application.groovy I found these lines:

    [pattern: '/index', access: 'permitAll'],
    [pattern: '/index.gsp', access: 'permitAll'],

I did not have index.gsp file the lines referred to, but it somehow worked in grails 3.3.8 and started failing in 3.3.10 . Removing those two lines fixed my issue.

I had the same issue because I had an index.gsp left over from the original creation. Deleting the index.gsp allowed my home route to work.

I also had a similar issue and resorted to using grails 3.3.9 for now.

It is a known issue and there is a fix in the newest snapshot version.

https://github.com/grails/grails-core/commit/26aff5a534f41e7756b012de36b5a362a2f6b588#diff-a2f510398df3ed2953f2cb6f233684fb

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM