Grails 3.0.10 redirect not use context path, but using directory name

532 Views Asked by At

I'm converting an app from grails 2.5.2 to 3.0.10. In many controllers and oher places I do

redirect(url: "/my/url", permanent: true)

I have set the context path in application.groovy:

server.'context-path' = '/myapp'

When the redirect is called, the redirect is coming through as /my-app-dir/my/url install of /myapp/my/url

Why is grails 3.0.10 using the application directory in the url instead of context-path? I am running this via grails clean; grails run-app

1

There are 1 best solutions below

0
simplybeautifulcode On

After running it through the debugger, it turns out you must also set:

grails.serverURL= "http://localhost:8080/myapp"

In application.groovy for redirects to work properly.