Forum Moderators: phranque

Message Too Old, No Replies

Apache JBoss Proxy - Redirect URL

Local URL showing up in links

         

kkarthikjgd

5:53 pm on May 29, 2009 (gmt 0)

10+ Year Member



Hi,
I am having a similar issue as [webmasterworld.com...]

Ihave included the Rewrite rule as well but it has not solved the issue. I have been stuck for about 3 days in this.

Please Help!. Any help greatly appreciated.

My httpd.conf looks like the following: ( I honestly do not know what the [PT] at the end of rewrite rule is but I copied it from the previous post mentioned above.

<VirtualHost 10.13.102.121:80>
ServerAdmin UNIXAdmin@email.com
ServerName myservername.domain.com
DocumentRoot /apps/apache/htdocs
ErrorLog /apps/apache/logs/error.log
TransferLog /apps/apache/logs/access.log

RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACEŠTRACK)
#RewriteRule .* - [F]
RewriteRule ^(.*)$ [myservername.example.com]/$1 [PT]

ProxyPass /ws/services http://jboss-server:8190/webservices/services
ProxyPassReverse /ws/services http://jboss-server:8190/webservices/services

</VirtualHost>

[edited by: jdMorgan at 8:39 pm (utc) on May 29, 2009]
[edit reason] de-linked proxy URLs, set hostname to example.com [/edit]

g1smd

6:10 pm on May 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'd start by looking at the complete RewriteRule documentation on the Apache website to understand what every single character of what you have there means.

kkarthikjgd

6:23 pm on May 29, 2009 (gmt 0)

10+ Year Member



Just to clarify,
When I type:
http://myservername.example.com/ws/services, it gets redirected correctly to http://jboss-server:8190/webservices/services

However, the wsdl links in that page keep pointing to http://jboss-server:8190/webservices/services/ServiceName?wsdl instead of
http://myservername.example.com/ws/services/ServiceName?wsdl

[edited by: jdMorgan at 8:41 pm (utc) on May 29, 2009]
[edit reason] de-linked, example.com [/edit]

jdMorgan

7:22 pm on May 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ProxyPassReverse is supposed to take care of this.

For now, I suggest that you delete the unnecessary mod_rewrite stuff, and concentrate on debugging the ProxyPass and ProxyPassReverse. That mod_rewrite code looks suspect to me anyway, since it only applies to TRACE and TRACK methods, and has no effect on GET, HEAD, PUT, etc.

Also, look into how the links are formed on your back-end-generated pages; They should link to a relative URL-path or to a canonical URL containing the front-end server's domain, and should not contain any reference to the back-end server.

See Apache mod_proxy documentation.

There should be no redirects at all here. What we have is a proxy through-put from the front-end server to the back-end server. In other words, if the front-end server receives a client (e.g. a browser) request for a back-end service, it makes a request to the back-end server on behalf of the client, and then passes the back-end server's response back to the client.

Jim

kkarthikjgd

8:10 pm on May 29, 2009 (gmt 0)

10+ Year Member



Thanks jd. I removed the rewrites and turned ProxyPreserveHost on. That took care of the issue.
However, I had to make sure that the context root on the actual server and the context root used in apache were the same (They were myws in apache and mywebservices in jboss)

jdMorgan

8:38 pm on May 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah, this kind of stuff makes my head hurt... :)

So I document it thoroughly, and then try not to touch it ever again.

Jim