Hi,
I have been using https with Seam for a while not and in our environment we have http and
https setup at the load balancer level.
An hrrp request comes to the load balancer. The load balancer internally forwards requests
to tomcats that only have http setup. We do this to avoid setting up https and related
certificates for every tomcat in our pools. Each tomcat in the pool is setup on a
different port only accessible internally.
After looking at the Seam documentation and org.jboss.seam.navigation.pages file. It seems
that if a page view-id is marked with scheme=https, the framework appends port info. If no
httpsport is defined, it retrieves the server instance port and appends that.(see code at
end of this post)
In our case, this could would return internal tomcat port, not the externally accessible
port (no port or port 80). this will cause a redirect to the incorrect port. eg.
external url:
http://mysite.com and
https://mysite.com
two tomcats in pool at
http://tomcats.com:123 and
http://tomcats.com:124
in pages.xml or somewhere else, would it be possible to indicate scheme https for view-ids
but not append ":PORT"?
eg redirection
http://mysite.com to https:://mysite.com with no appended port info.
The code i looked at is below.
Thanks in advance
Nik Khilnani
| public String encodeScheme(String viewId, FacesContext context, String url)
| {
| String scheme = getScheme(viewId);
| if (scheme != null)
| {
| String requestUrl = getRequestUrl(context);
| if (requestUrl!=null)
| {
| try
| {
| URL serverUrl = new URL(requestUrl);
|
| StringBuilder sb = new StringBuilder();
| sb.append(scheme);
| sb.append("://");
| sb.append(serverUrl.getHost());
|
| if ("http".equals(scheme) && httpPort != null)
| {
| sb.append(":");
| sb.append(httpPort);
| }
| else if ("https".equals(scheme) && httpsPort !=
null)
| {
| sb.append(":");
| sb.append(httpsPort);
| }
| else if (serverUrl.getPort() != -1)
| {
| sb.append(":");
| sb.append(serverUrl.getPort());
| }
|
| if (!url.startsWith("/")) sb.append("/");
|
| sb.append(url);
|
| url = sb.toString();
| }
| catch (MalformedURLException ex)
| {
| throw new RuntimeException(ex);
| }
| }
| }
| return url;
| }
|
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118081#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...