Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TargetURI needs to be configured outside of the WAR/EAR #124

Open
dev-mansonthomas opened this issue Oct 4, 2017 · 4 comments
Open

TargetURI needs to be configured outside of the WAR/EAR #124

dev-mansonthomas opened this issue Oct 4, 2017 · 4 comments

Comments

@dev-mansonthomas
Copy link

Hi,

I've got a requirement that the WAR/EAR can't be modified from DEV to PRODUCTION.
So I need that the targetURI can be configured outside of the WAR/EAR.
For example, all the properties of the application is read from Linux FS : /apps/configuration/web/myApp.properties

Is it possible out of the box?
Can it be configured after the container startup? Any sample code to do that?

Project is not using SpringMVC.

@dsmiley
Copy link
Collaborator

dsmiley commented Oct 4, 2017

Hi,
Perhaps the proxy could be easily modified to load it's configuration settings from a properties file?

@dev-mansonthomas
Copy link
Author

dev-mansonthomas commented Oct 4, 2017 via email

@litaocdl
Copy link

Hello, Do we have a solution for this requirement now ?

@EdgewareRoad
Copy link
Contributor

I had a similar problem where I needed to control the target URI programmatically and (probably overkill for what you want) dynamically at runtime. I solved this by extending the Proxy Servlet and, essentially:

  • Overriding getConfigParam() to ensure that P_TARGET_URI had a dummy value (so I didn't need to set this inside my JAR file but that the underlying base class didn't break)
  • Overriding rewriteUrlFromRequest() so that the new target request could be set programmatically (you can set this how you want in your own external property file, database etc.). For this latter bit, it was easiest to copy code from the base class and to amend as there's lots of useful logic in there.

Hope this helps

Phil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants