Author: hansbak
Date: Fri Apr 22 02:40:37 2011
New Revision: 1095859
URL:
http://svn.apache.org/viewvc?rev=1095859&view=revLog:
Using Amazon EC2 loadbalancer which already decrypted to http, content should still be served https so checking for X-Forwarded-Proto request variable too
Modified:
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ContentUrlTag.java
Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ContentUrlTag.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ContentUrlTag.java?rev=1095859&r1=1095858&r2=1095859&view=diff==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ContentUrlTag.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ContentUrlTag.java Fri Apr 22 02:40:37 2011
@@ -67,7 +67,10 @@ public class ContentUrlTag extends BodyT
return;
}
GenericValue webSite = WebSiteWorker.getWebSite(request);
- appendContentPrefix(webSite, request.isSecure(), urlBuffer);
+ String forwardedProto = request.getHeader("X-Forwarded-Proto");
+ boolean isForwardedSecure = UtilValidate.isNotEmpty(forwardedProto) && "HTTPS".equals(forwardedProto.toUpperCase());
+ boolean isSecure = request.isSecure() || isForwardedSecure;
+ appendContentPrefix(webSite, isSecure, urlBuffer);
}
public static void appendContentPrefix(GenericValue webSite, boolean secure, Appendable urlBuffer) throws IOException {