cancel
Showing results for 
Search instead for 
Did you mean: 

disable external image for https

cts_sergiu_dunc
Champ in-the-making
Champ in-the-making
Hi,

We are using Alfresco in ssl mode.
However, the logo image is imported in http mode:
http://sflogo.sourceforge.net/sflogo.php?group_id=143373&type=1

Due to this are getting warnings in our internet browsers.
Is there anyway to have the image loaded locally from disk and not from an external site ? This may be source of insecurity when running in full https mode.

Thank you,
Sergiu
18 REPLIES 18

lgr
Champ in-the-making
Champ in-the-making
Hi,

For your information, on my Alfresco, the url is modified on the fly with a vulture reverse proxy (http://arnaud.desmons.free.fr/wordpress/?page_id=36 or http://vulture.open-source.fr) which uses apache with modproxyperlhtml.

It works well. I just had to put the image in the local server, and no more modification were needed.

Laurent.

mrudmann
Champ in-the-making
Champ in-the-making
Can I use Apache to reverse proxy like Vulture?  If so, can you provide me with an idea as to what I need to configure in Apache to accomplish this?  Or, is there a good link you can point me to?

Thanks!

lgr
Champ in-the-making
Champ in-the-making
Yes of course, as vulture is based on an apache server with the reverse proxy configured.

Using vulture should only be easier than configuring apache as it includes all configuration tasks in a web gui.

Laurent.

piman31415
Champ in-the-making
Champ in-the-making
The problem with trying to replace the image link with an Apache proxy statement is that the proxy from Apache passes the user's request to the Tomcat (or JBoss) server, but the response which contains the bad link goes straight out of Tomcat to the user's browser without going back through Apache.  So, any filtering needs to take place on the Tomcat side of the house, not in Apache.

I was able to filter Tomcat's output to perform a line-by-line search of all output for the Alfresco Community logo and replace it with a link to a local image using the following process:

1.  I used IBM's devworks ReplaceTextFilter to perform the filtering.  A description of the technique and a link to download the code can be found at this URL: http://www.ibm.com/developerworks/java/library/j-tomcat/?open&l=101,t=grj,p=TomcatTricks

2.  After downloading the code to my server, I copied the "com" directory and all sub-directories from "code/dvworks/WEB-INF/classes" to Alfresco's "$TOMCAT_HOME/webapps/alfresco/WEB-INF/classes" directory.

3.  Next, I edited the web.xml file in "$TOMCAT_HOME/webapps/alfresco/WEB-INF/web.xml" to add the following filter text:

  
 
   <filter>
        <filter-name>Replace Text Filter</filter-name>
        <filter-class>com.ibm.devworks.filters.ReplaceTextFilter</filter-class>
         <init-param>
            <param-name>search</param-name>
           <param-value>http://www.alfresco.com/images/alfresco_community_horizont.gif</param-value>
          </init-param>
         <init-param>
            <param-name>replace</param-name>
            <param-value>https://www.mysite.com:8443/myapp/images/logo/alfresco_community_logo.gif</param-value>
         </init-param>
    </filter>

Note:  "myapp" is a dummy/non-alfresco application that is also served by the Alfresco Tomcat web container.  This provides a place to store the image outside of Alfresco.  It might also be possible to store the image w/in the Alfresco app tree, but I chose this location instead.  I copied the Alfresco Community image from the Alfresco site to the specified directory on my local server and renamed it to the specified name (see above).

4.  Next, after the other filter definitions in the web.xml file, I added the following filter mappings to invoke the filter at the appropriate times (on all '/alfresco/navigate' and all '/alfresco/faces' pages):

  
 
    <filter-mapping>
        <filter-name>Replace Text Filter</filter-name>
        <url-pattern>/navigate/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>Replace Text Filter</filter-name>
        <url-pattern>/faces/*</url-pattern>
    </filter-mapping>

5.  I restarted the Alfresco app, and voila, the non-ssl url's to Alfresco's home page were replaced, on-the-fly, with mappings to the image stored on the local server. 

This should be considered a work-around only, as the filtering search-and-replace operations consume resources on every page reference.  When the Alfresco team fixes this in a later release (assuming they do…), this filtering hack should be removed.

mrudmann
Champ in-the-making
Champ in-the-making
Thanks for the tip.

I applied the filter mentioned above.  I set my filter up to replace the http image with an https image on my server (and within the alfresco tomcat environment). 

It partially worked.  I no longer get the "nag" screen asking if I want to display nonsecure items, but the image is not successfully replaced (I see that image indicating the graphic can't be displayed/found, etc., but I know the image is there).  Again, I am trying to point to an image within my secure alfresco/tomcat environment.

Any thoughts for me?  I am trying to avoid running Apache as I don't really see a need for it at this time.

Thanks!

piman31415
Champ in-the-making
Champ in-the-making
1.  Where does the server "think" the image is stored?  You can find this out by right-clicking on the image, selecting the "Properties" option, and looking at the location information in the resulting pop-up.

2.  Where is the image actually stored?  As I stated in the original post, I believe I stored my image in a Tomcat sister application to the one used by Alfresco.   In other words, under my $ALFRESCO_HOME/tomcat/webapps there are two sub-directories, one for the Alfresco application (…/webapps/alfresco) and one that I used for the image storage (…/webapps/myimages - or whatever app name you want to use).   My primary reason for storing the replacement image outside Alfresco was to keep the Alfresco distribution in synch with the "standard" download.  But I also believe that files stored under the Alfresco application may not be directly accessible due to the navigation services that Alfresco uses to intercept and redirect URLs that point into the Alfresco application.  So, to make this work, you may have to create this sister application/directory structure.

If you can report the data for these two items, I can look for anything obvious (or, maybe, not so obvious…).

Dave C.

mrudmann
Champ in-the-making
Champ in-the-making
Dave,
I created a directory as follows:ALFRESCO_HOME/tomcat/webapps/myimages.  within this directory, I placed the alfresco logo image.  then, in the web.xml file, I coded the location https://192.x.x.x:8443/myimages/alfrescologo.gif as the parameter to replace the http logo (per your example).

When I right click and select properties, my image indicates it is looking at https://192.x.x.x:8443/myimages/alfrescologo.gif for the image - which is where I placed it.

I see the "X" image instead of the alfresco logo.

Any feedback is greatly appreciated!

-Matt

piman31415
Champ in-the-making
Champ in-the-making
Perhaps this is a permissions problem…Can you check the permissions on the image and the directory in which it's stored?  Make sure the image and containing directory have the same group/owner as the other Alfresco directories/files and the appropriate permissions to enable the Alfresco/Tomcat server to access them.

mrudmann
Champ in-the-making
Champ in-the-making
I would like to report back SUCCESS!

After making the filter changes per your suggestion above, I placed the alfresco graphic in the TOMCAT_HOME/webapps/alfresco folder.  It worked like a charm!

I am now able to run Alfresco under SSL without the annoying nag screen from the graphic and I didn't have to recompile the entire application.  What a simple solution.

Thanks for your help, Dave!