This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

any experience out there with mod_proxy_html or other uri modification methods?

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!!
 
Derek Murphy
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 21575
146
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds more like a job for mod_rewrite.

You make it sound like there's probably going to be dozens of rewrite rules required. Hopefully not, though. Usually - but not always - relative URLs can be more flexible than absolute URLs.
 
Derek Murphy
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tim Holloway
Saloon Keeper
Posts: 21575
146
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Derek Murphy
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
What a stench! Central nervous system shutting down. Save yourself tiny ad!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!