Derek Murphy

Greenhorn
+ Follow
since Mar 26, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Derek Murphy

Forgive me for posting in the tomcat forum. If anyone has good recommendations on an apache web forum, I'll gladly post there instead, but so far I'm having good luck here

I have a wordpress blog that I am installing on a webserver in the dmz. I have a load balancer in front of it that will proxy to the webserver essentially. However, the trick is the blog needs to be accessed via www.domain.com/somestring but the blog will actually be living at blog3.domain.com. There's also blog1 and blog2.domain.com living on the same server.

Typically what I would do on the load balancer side is say something like if uri = /somestring then send/proxy to pool blogwebservers(label for the pool of blog webservers).

However, since the deal is, they want to keep everything as www.domain.com/somestring, and not have it actually redirect... I'm not sure how I will be able to tell the webservers (set up with 3 virtual hosts for each blogX) that when uri=/somestring then send to virtualhost blog3.domain.com without having it actually redirect.

Is there any way to possibly set a virtual host to include a uri? As I write this, I'm suspecting it may be more of a load balancer specific issue since that is causing the complexity since I need to retain the non blog domain/uri.

I think one alternative may be to have this specific blog listen on a different port (like 81) and then just send everything that matches /somestring to that new pool.
11 years ago
Hiya,
Not exactly specific to tomcat, but I'm hoping someone has had similar experiences.

I have an apache wordpress blog at blog.domain.com
I have an IIS 6.0 website at www.domain.com

I need to proxy requests from www.domain.com/blog to blog.domain.com without the url changing (i.e. everything should look www.domain.com/blog)

Any thoughts as to if this can be done?
Cheers,
-Derek
11 years ago
That's kind of what I always suspected. Thanks
11 years ago
Hiya,
I've never actually compiled/installed the APR libraries for tomcat.

What exactly do they improve? I've read that it increases performance in certain situations for production. Tomcat never has it included by default...

so my questions are..
1) When should I compile/install apr?
2) What does it actually change within tomcat regarding performance
3) Is there ever a time when I wouldn't want to install apr?

Cheers,
11 years ago
Interesting...

See... I honestly believe it's possible to do what I'm trying to do. I just don't know how all the pieces work together/should be configured

I'm not concerned with things being bookmarkable. These are all for POC environments so end users never bookmark anything except a main url.

Once I actually get it rolled out I think I'm going to revisit this. I KNOW it can be done and it's going to irk me forever if I can't get it working how I originally intended.

Thanks very much for the help!
11 years ago
well actually wouldn't mod_rewrite not be able to help in that case? Mod_rewrite is only for url manipulation, not for internal code path manipulation I thought?

I looked into mod_proxy_html further... and it appears that it can do what I want it to do... I just don't know how to use it

the things that need changing are the actual html tags in the code.. so src=/customapp1/images/image.png needs to be changed(in the code) to reflect src-/insertedstring/customapp1/images/image.png

but only for the end user to see. It will be stripped back out once the request goes back to the application so it functions properly.

I threw in the towel yesterday and now I'm going to take the approach of a new namespace.

So, instead of www.domain.com/app1, I'm just creating app1.domain.com and writing a load balancer rule that says if host = app1.domain.com then send everything to appservers.

Not ideal... but at least it'll save my hair from all falling out
11 years ago
now that I think about it a bit more, I don't think that even mod_proxy_html will help out in this particular case.

The big issue that I face isn't necessarily with the url's the end user sees... but rather the way things are linked within the application. There's a lot of root/relative linking.. so I have things like src=customapp1/images/something.jpg and src=customapp2/images/something2.png and src=customapp3/js/somefunction.js

anyways... on and on we go, for about 60 custom apps, as well as other root level references.

The real solution is to deploy it outside of a context root so I can change the app to be www.domain.com/nonRootContext/application... but the application doesn't support it.. due to the way things are linked...

so essentially, what I really need is something that can modify all of the html that gets passed through the browser/server and have all links(relative and hardcoded) to get some sort of constant prefixed in there.

My gut feeling is that, it's impossible, and I'm going to have to setup a subhost (app.domain.com) instead of being able to use our single namespace www.domain.com/app for authentication etc...

I'm starting to feel pressure, so all geniuses come out of the woodwork

Cheers.
11 years ago
Hi again,
Feel like a regular now

I need to change my URLs on the fly and insert a string into them. Reason being is I have an application that is poorly designed and I need to configure my load balancer to send traffic to the appserver(tomcat) using a single string /blah/

original url www.domain.com/fancyurl -> one time rewrite to old(should be new) url below.

so... old url = www.domain.com/web/appname/*
new url = www.domain.com/blah/web/appname/*

I've heard mod_proxy_html can do this for me but I have been banging my head for hours trying to get it to work.

Essentially I need the URL for the user to always be www.domain.com/blah/web/appname/* but once it leaves the load balancer, apache needs to strip out the /blah/ for the application to function properly. Once apache is ready to return data to the end user, it needs to add /blah/ back into the URI so the user (and load balancer) always think they are on www.domain.com/blah/web/appname/*

The /web/ piece actually can vary too. It can be /web/ or /group/

This is proving to be quite a difficult task and I'm starting to lose my hair...

Any help, most appreciated!!!
11 years ago
Hi Tim,
Thanks for the responses!

This clarifies things a bit in terms of how the context stuff works. I finally got the context path's working so that's grand.. although the application is misbehaving.. such as life.

Offtopic (sort of) question, but kind of related..

If I compile an apache httpd module on a development server, can I simply move the compiled modules (so files) to my production server, without the need to install any of the supporting libraries etc.. that I needed when I compiled it?
11 years ago
nope. Not deploying context.xml within the war. The war is being provided to me.

I think I'm slowly figuring this stuff out
11 years ago
I think I actually might have just figured it out, although I'm not completely confident on how it's working, so if someone could explain, that would be awesome

I have an infocenter webapp (eclipse based documentation) deployed at $catalina_home/server/webapps/infocenter/ (server/webapps/infocenter i created)

I created $catalina_home/conf/Catalina/localhost/blah#infocenter.xml

<Context path="/blah/infocenter" docBase="/usr/local/tomcat/current/server/webapps/infocenter" debug="0" privileged="false">

</Context>

I then unjar'ed the war file manually in $catalina_home/server/webapps/infocenter

This seemed to make everything work.
My question is... how can I get tomcat to auto-deploy stuff that lives in $catalina_home/server/webapps/ just like the normal webapps?

I think the big thing I was missing all along is the # based naming of the context.xml files. I had never realized those needed to include # signs for multi level naming conventions. I always thought that's what the context path specified.

Which I guess brings me to my next question... what is the Context path actually doing if it's not telling tomcat what the URI is? It seems like the naming of the xml (blah#infocenter) in this case is what tells tomcat what the URI is going to be.
11 years ago
Hi,
I've never been able to figure out how to properly use context paths with tomcat. It's really frustrating because reading the docs it seems like it's something that should be very easy, and I know I am not that dumb!!

In the past how I got around not getting them to work was to name my wars with a #.. so deploying first#second#third.war in webapps got me a url of http://www.domain.com/first/second/third/index.jsp (for that particular application).

Now I would like to figure out how to get a similar result using context paths.

I've created appname.xml in $catalina_home/conf/Catalina/localhost/infocenter.xml and tried starting tomcat
<Context path="/blah/infocenter" docBase="/usr/local/tomcat/current/server/webapps/infocenter" debug="0" privileged="false">

</Context>

based on what I've read, this should result in a url of http://www.domain.com:8080/blah/infocenter/index.jsp (again the webapp im depoying has index.jsp as it's resource)... but this did not work.

I've tried about 100 different things and I just can't figure it out.

Also when using context roots, I assume you have to explode the war yourself and it won't autodeploy?

Back to banging my head on the desk for now...

11 years ago

Tim Holloway wrote:Is there any particular reason you're proxying using http instead of the ajp protocol?



ignorance?

are you saying instead of..
ProxyPass /discovery-web-guest http://labvm42-107.lab.domain.com:18080
ProxyPassReverse /discovery-web-guest http://labvm42-107.lab.domain.com:18080

it should be

ProxyPass /discovery-web-guest ajp://labvm42-107.lab.domain.com:18080
ProxyPassReverse /discovery-web-guest ajp://labvm42-107.lab.domain.com:18080


If so, what does that really change? Is performance better?
11 years ago
I've gotten much further, and I think now my need has changed. Below is the config I'm working with, and now essentially all I need to figure out is how to get /discovery-warranty to always be in the URL, regardless of what someone clicks on, until they go to another location.

For example. http://www.domain.com/discovery-warranty
this needs to be authenticated with a /location directive.

there will be other /discovery-somethings that will be authenticated with a /location directive.

We have a load balancer that checks for www.domain.com/discovery-somethings and if it receives a request for www.domain.com/somethingNotDiscovery it will redirect to a main login page... so I need to make sure for each proxy statement, the url is modified/or maintained to always have discovery-something as the first part(or complete) uri, regardless of what someone clicks on while they are in a particular proxied app.




#
# Proxy back to tomcat
#
<Location /web/testwarranty>
Satisfy any
Options -FollowSymLinks -Indexes
AllowOverride None
Order deny,allow
Deny from all
Allow from env=BYPASS_AUTH

AuthLDAPEnabled on
AuthLDAPAuthoritative on
AuthName "Demo"
AuthType basic
AuthLDAPBindDN "CN=demoadmin,OU=Demo,DC=something,DC=domain,DC=com"
AuthLDAPBindPassword "somepass"
AuthLDAPURL "ldap://ldapserver:3268/DC=something,DC=domain,DC=com?sAMAccountName?sub?(objectClass=user)"
AuthLDAPGroupAttributeIsDN on

Require user "dmurphy"
</Location>

#
<Location /web/guest>
Satisfy any
Options -FollowSymLinks -Indexes
AllowOverride None
ReWriteEngine on
Order deny,allow
Deny from all
Allow from env=BYPASS_AUTH

AuthLDAPEnabled on
AuthLDAPAuthoritative on
AuthName "Demo"
AuthType basic
AuthLDAPBindDN "CN=demoadmin,OU=Demo,DC=something,DC=domain,DC=com"
AuthLDAPBindPassword "somepass"
AuthLDAPURL "ldap://ldapserver:3268/DC=something,DC=domain,DC=com?sAMAccountName?sub?(objectClass=user)"
AuthLDAPGroupAttributeIsDN on

Require user "bwood"
</Location>

# enable the SSL proxying
#SSLProxyEngine On
RewriteEngine on
RewriteRule ^/discovery-warranty$ http://labvm42-107.lab.domain.com:18080/web/testwarranty/home

ProxyRequests off

#the proxy location (app) automatically redirects to web/guest which is why the first location is for web/guest
ProxyPass /discovery-web-guest http://labvm42-107.lab.domain.com:18080
ProxyPassReverse /discovery-web-guest http://labvm42-107.lab.domain.com:18080

ProxyPass /discovery-warranty http://labvm42-107.lab.domain.com:18080/web/testwarranty
ProxyPassReverse /discovery-warranty http://labvm42-107.lab.domain.com:18080/web/testwarranty

#This / catchall seems to be the only way to get additional page clicks to work as each click changes the url in some way.
ProxyPass / http://labvm42-107.lab.domain.com:18080/
ProxyPassReverse / http://labvm42-107.lab.domain.com:18080/
11 years ago
I'm not trying to get load balancing/clustering working in apache or tomcat. While there are 2 tomcats running on the same box, neither serve the same applications.

tomcat 5.5 - 8080
tomcat 6.0.18 - 18080

im using mod_proxy, not mod_jk. I guess more of what I need to figure out is how to do wildcard type functionality with mod_proxy/proxypass to be able to get some fancy proxying going on.
11 years ago