sim51 / logisima-play-cas

CAS authentification module (SSO)
http://www.bsimard.com
19 stars 8 forks source link

Incorrect service URL generation #11

Closed davidbarral closed 12 years ago

davidbarral commented 12 years ago

getServiceUrl() at CASUtils uses Router.getFullUrl to get the Service URL, this approach does not work in production environments that use a reverse proxy (i.e. Apache + Tomcat). In those cases the service URL has the proxified machine domain instead of the reverse proxy machine domain.

I believe this method should rely on the application.url configuration value.

sim51 commented 12 years ago

Can you tell me your play! Version please?

sim51 commented 12 years ago

Do you have the preserveHost directive into your proxy configuration ?

davidbarral commented 12 years ago

Play version 1.2.3

I am not in charge of the reverse proxy, so right now I cannot tell you how is the ProxyPreserveHost option set. I will try to get the info as soon as posible.

sim51 commented 12 years ago

This is play! code for Router.getFullUrl

public static String getFullUrl(String action, Map<String, Object> args) { ActionDefinition actionDefinition = reverse(action, args); String base = Http.Request.current() == null ? Play.configuration.getProperty("application.baseUrl", "application.baseUrl") : Http.Request.current().getBase(); if (actionDefinition.method.equals("WS")) { return base.replaceFirst("https?", "ws") + actionDefinition; } return base + actionDefinition; }

So full URL is firstly base on the request, that's why i asked you for the ProxyPreverseHost option, and secondly on the property application.baseUrl defined into application.conf.

That's why I think, there is no issue in my side ...

FYI, I use my module into an application on a tomcat behind an apache.

Let me know your proxy configuration before I close the ticket !

davidbarral commented 12 years ago

Yep, seems that the problem might be there and not in your module. As I told you before I do not have the proxy related info at the moment. I will tell you ASAP.

Thanks!

davidbarral commented 12 years ago

Hi! I finally have the info. The reverse proxy was not preserving the hosts. Sorry for the inconvinience and thanks.