4 Replies Latest reply on Oct 9, 2009 3:57 PM by Charles Bihis

    how to change the root url of jboss

    Charles Bihis Newbie

      Hi all,

      I have a (seemingly) simple problem that I'm hoping has a simple solution. I've set up JBoss on my server so when I go to www.example.com, I see the beautiful default JBoss welcome page. When I deploy my applications, say, "myApp", I go to www.example.com/myApp and I see my app. Great, this is what I expected.

      BUT, now I want to change the default root URL for my JBoss applications. Particularly, I want to make it such that when I go to www.example.com/jboss, I see the JBoss welcome page, and when I go to www.example.com/jboss/myApp, I see my app. In short, I want to change the root URL from www.example.com to www.example.com/something without having to change the context-roots in each project specifically. I hope I've explained that well enough. This seems like it'd be an easy thing to do, but I can't figure out how. Can anyone help?

      *BTW, I'm running JBoss 5.1.0.GA on CentOS.

      Thanks in advance


      Charles

        • 1. Re: how to change the root url of jboss
          jaikiran pai Master

           

          "charlesbihis" wrote:
          In short, I want to change the root URL from www.example.com to www.example.com/something without having to change the context-roots in each project specifically.


          See a similar post here http://www.jboss.org/index.html?module=bb&op=viewtopic&t=161785

          • 2. Re: how to change the root url of jboss
            Charles Bihis Newbie

            Hi Jaikiran,

            Thanks for the reply, but that's not exactly what I want to do. I omitted part of my problem for clarity, but I suppose I should mention it now. I would like to change the root URL from www.example.com to www.example.com/something so that, for instance, when I visit www.example.com/something, I see the JBoss welcome page...BUT, I would still like there to be other content on www.example.com. So, a URL rewrite wouldn't work because I would still like there to be some content on the base URL, i.e. www.example.com, as opposed to re-writing the URL and sending to www.example.com/something. Does that make sense?

            • 3. Re: how to change the root url of jboss
              Peter Johnson Master

              Is the URL www.example.com also handled by JBoss AS or by something else? If by JBoss AS then it is not possible, at least, not without changing every context for every app [hmm, I don't even know if you can set /jboss/app1 as a context... - just now tried it - it works - well, ya l'arn somethin' new ev'r' day!] (see next paragraph for an alternative). If it will be handled by something else, then you might be able to do this by front-ending with Apache and have it redirect every request for www.example.com/jboss to JBoss AS, after rewriting the URL.

              By the way, if all URLs are to be handled by JBoss AS why not change just the context of the home page to /jboss and keep app1 at /app1 (rather than at /jboss/app1)? And then use the / context for the appropriate app.

              • 4. Re: how to change the root url of jboss
                Charles Bihis Newbie

                Hi Peter

                Yes, the base URL www.example.com will be handled by Apache. So, the gist of it is that I would like www.example.com and all other URLs to be handled by Apache, serving up PHP pages...EXCEPT, anything that goes to www.example.com/servlet/* which I would like to configure to be handled by JBoss to serve up JSP pages and servlet applications. Now, I've been able to do all (err, most) of this...have Apache handle all requests to the base URL and all others, and using mod_jk, I've enabled a filter that forwards all requests to www.example.com/servlet/* to go to JBoss. The only problem is that when the request goes to JBoss, JBoss looks for an application or page in the /servlet/ context, which has nothing there, so it gives me a "Resource not found" error.

                So, in short, I've reduced the problem to just being able to change the root URL of JBoss from www.example.com to www.example.com/servlet, the idea being that if I can get the welcome page to display there, then I can deploy applications as normal, but access them with the URL www.example.com/servlet/appName instead of www.example.com/appName. Like I said, I *could* go in and change the context root of each individual application that I want to deploy to explicitly include /servlet/ before the app-name, but that seems to me less than ideal, not to mention that I'd have to open up each previously written app, hardcode a context URL specific for deployment on this instance of JBoss, recompile, and redeploy.

                Anyways, I was trying to keep the problem as simple as possible just for posting's sake, but I guess it was necessary to dive right in. If anyone can help, that'd be great.

                Thanks again!


                Charles