Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glu console does more absolute url redirects with 4.7.0 #213

Closed
ypujante opened this issue Apr 11, 2013 · 4 comments
Closed

Glu console does more absolute url redirects with 4.7.0 #213

ypujante opened this issue Apr 11, 2013 · 4 comments
Labels

Comments

@ypujante
Copy link
Member

From the forum... http://glu.977617.n3.nabble.com/Glu-console-does-more-absolute-url-redirects-with-4-7-0-td4025588.html

@ypujante
Copy link
Member Author

The code that handles redirect in grails 1.3.5 and grails 2.2.1 has changed quite a bit and explain the difference:

For 1.3.5: https://github.com/grails/grails-core/blob/v1.3.5/src/java/org/codehaus/groovy/grails/web/metaclass/RedirectDynamicMethod.java#L207

String redirectUrl = useJessionId ? response.encodeRedirectURL(actualUri) : actualUri;
response.sendRedirect(redirectUrl);

For 2.2.1: https://github.com/grails/grails-core/blob/v2.2.1/grails-plugin-controllers/src/main/groovy/org/codehaus/groovy/grails/web/metaclass/RedirectDynamicMethod.java#L174

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.

@ypujante
Copy link
Member Author

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

@ypujante
Copy link
Member Author

Reopening because of Dashboard extra redirect

@ypujante ypujante reopened this Apr 15, 2013
@ypujante
Copy link
Member Author

fixed in glu 4.7.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant