0

This question is NOT tagged on playframework as it most likely is solveable by people with strong http knowledge (and those users tend to skip playframework questions).

playframework 1.2.5 has the following snippet of code

if (url.startsWith("http")) {
    //
} else if (url.startsWith("/")) {
    url = String.format("http%s://%s%s%s", request.secure ? "s" : "", request.domain, (request.port == 80 || request.port == 443) ? "" : ":" + request.port, url);
} else {
    url = String.format("http%s://%s%s%s%s", request.secure ? "s" : "", request.domain, (request.port == 80 || request.port == 443) ? "" : ":" + request.port, request.path, request.path.endsWith("/") ? url : "/" + url);
}

This code happened to break our login/logout since it redirects to http which is incorrect as even though our playframework is in http, our LB is in https to the user. Why would someone have this code? Isn't the relative url enough for a redirect?

I commented out the code and now our site is working fine, but I am still left with that achy feeling of why was this code put into the playframework in the first place?

Any ideas, guesses would be great or if you know the answer, even better.

thanks, Dean

Lev Levitsky
  • 63,701
  • 20
  • 147
  • 175
Dean Hiller
  • 19,235
  • 25
  • 129
  • 212

1 Answers1

1

Is this a 302 redirect? It requires an URL by specification. This doesn't mean many sites don't use relative path and browsers I've seen handle that just fine.

Two relevant old questions:

Community
  • 1
  • 1
akostadinov
  • 17,364
  • 6
  • 77
  • 85