This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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!!!
Joined: Mar 26, 2010
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
Well it's too late to save my hair (which is why my ranch photo has me wearing a hat to prevent camera glare ).
But I'm running sites that combine mod_proxy with mod_rewrite to do stuff like that. The outgoing URLs might be a bit sticky, though. If you want them bookmarkable under abstract URLs, you may have to format them when you generate the pages.
Joined: Mar 26, 2010
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.