svn commit: r1095859 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ContentUrlTag.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1095859 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ContentUrlTag.java

hansbak-2
Author: hansbak
Date: Fri Apr 22 02:40:37 2011
New Revision: 1095859

URL: http://svn.apache.org/viewvc?rev=1095859&view=rev
Log:
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 {