logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: [Solved] Problem with proxy and Output filters
Author
hbbk



Joined: 13 Nov 2013
Posts: 3
Location: France

PostPosted: Wed 13 Nov '13 13:54    Post subject: [Solved] Problem with proxy and Output filters Reply with quote

hi

I've an apacher server (Apache/2.2.22 (Debian)) wich goal is to proxy application server (tomcat).
Mainly https://apache/service proxy to http://tomcat:8080/

My problem is that the tomcat service hard write links in its results (http://tomcat:8080/result) so I put in place an external output filter to change all links in results to something usable by users. As the tomcat seems to outpuy gzipped content I added an inflate filter in the chain.

Code:

<VirtualHost: *443>
...
ProxyPass        /service  http://tomcat:8080/share
ProxyPassReverse /service  http://tomcat:8080/share
...
ExtFilterDefine MyFilter mode=output cmd="/bin/sed s#http://tomcat:8080#https://apache/service#g"
SetOutputFilter INFLATE;MyFilter
...


Unfortunately all this do not work

1- No output filter: ok, content-encoding: gzip
2- only INFLATE: ok, but still CE: gzip ??? (should be not?)
3- INFLATE;MyFilter : scrambled output, no CE gzip
4- MyFilter only: scrambled output, no CE gzip

1 seems normal, but 2 & 3 ?? Is there anything I don't understand in the way all this should work, or is there a bug or a conf directive to add somewhere ?
seems that the INFLATE filter do not work ?


I have absolutely no way to change anything in the tomcat server and I need to change these hardlinks...

thanks in advance for any help


Last edited by hbbk on Tue 19 Nov '13 13:39; edited 1 time in total
Back to top
maba



Joined: 05 Feb 2012
Posts: 64
Location: Germany, Heilbronn

PostPosted: Thu 14 Nov '13 20:07    Post subject: Reply with quote

Hello,

while it might be possible to do these things using a zillion of Apache modules, it is typically not a good idea.

With Apache and a backend Tomcat an old golden IT rule still applies: "keep it simple".

So what I would do in such a situation is to map the Tomcat WebApp context one by one. Example: lets assume you have a jenkins behind your Apache then you instruct Tomcat to use the context path /jenkins. The Tomcat container will then work relative to that.

URL: http://localhost:8080/jenkins

On the Apache side, you would just match that
Code:

<Location /jenkins>
ProxyPass        /  http://localhost:8080/
ProxyPassReverse /  http://localhost:8080/
</Location>


This would just pass everything right through.

Maba
Back to top
hbbk



Joined: 13 Nov 2013
Posts: 3
Location: France

PostPosted: Tue 19 Nov '13 11:33    Post subject: Reply with quote

thanks maba for your reply
but that's exactly what I do actually , I didn't put that in my previous message but everything is in a <Location> directive

the pb is that the tomcat application - this is alfresco - does hard write absolute links in it's code, with javascript, so somewhere inside the page there is somthing like

Code:
<script type="text/javascript">...
   {
      repositoryUrl: "http://tomcat:8080/alfresco"
   }...
//]]></script>


and that's what I want my filter to change elsewhere the webdav link for doculments is erroneous

I repeat I have no access to th etomcat server and all that I can do is filtering the results

any idea ?
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Tue 19 Nov '13 12:41    Post subject: Reply with quote

Have you looked at mod_proxy_html?
Back to top
hbbk



Joined: 13 Nov 2013
Posts: 3
Location: France

PostPosted: Tue 19 Nov '13 13:39    Post subject: Reply with quote

glsmith wrote:
Have you looked at mod_proxy_html?


yeah !!!! thanks a lot glsmith !

Code:
   
    <Location /share>
   # Il faut réécrire le contenu pour les liens webdav
    ProxyHTMLExtended On
   ProxyHTMLURLMap http://tomcat:8080 https://server
    #ProxyHTMLLogVerbose On
   SetOutputFilter proxy-html
    </Location>


works perfectly
Back to top


Reply to topic   Topic: [Solved] Problem with proxy and Output filters View previous topic :: View next topic
Post new topic   Forum Index -> Apache