Closed ypujante closed 11 years ago
The code that handles redirect in grails 1.3.5 and grails 2.2.1 has changed quite a bit and explain the difference:
String redirectUrl = useJessionId ? response.encodeRedirectURL(actualUri) : actualUri;
response.sendRedirect(redirectUrl);
String absoluteURL = actualUri.contains("://") ? actualUri : serverBaseURL + actualUri;
String redirectUrl = useJessionId ? response.encodeRedirectURL(absoluteURL) : absoluteURL;
int status = permanent ? HttpServletResponse.SC_MOVED_PERMANENTLY : HttpServletResponse.SC_MOVED_TEMPORARILY;
response.setStatus(status);
response.setHeader(HttpHeaders.LOCATION, redirectUrl);
So in 1.3.5, grails was generating a relative url and was letting the container handle the creation of the redirect link. In 2.2.1, grails has added the notion of a {{LinkGenerator}} which they use everywhere and generate the absolute URL themselves based on the {{grails.serverURL}} config parameter which explains the behavior we are seeing.
URL handling is a very tricky issue and I am not sure which solution is better.
Won't fix: according to the forum thread,
I confirm that not mentioning the grails.serverURL in the configuration works for us, and it will be fine in our setup.
which is the solution found there: http://stackoverflow.com/questions/12064567/grails-redirect-issue-with-domain-name-changing
Reopening because of Dashboard extra redirect
fixed in glu 4.7.1
From the forum... http://glu.977617.n3.nabble.com/Glu-console-does-more-absolute-url-redirects-with-4-7-0-td4025588.html