Re: Configure Apache HTTPD not to see the webapp name in the URL

Discussion in 'Java' started by Ben Jessel, Jun 28, 2004.

  1. Ben Jessel

    Ben Jessel Guest

    Thanks for everyone's input.

    However, I'm a little concerned that there's not a quick and easy
    apache way of doing this; what do commercial users do? I'm sure that
    there must be an apache way of doing this! Could it be done with
    virtual hosting or aliasing?

    Its a pity that you can't just define a virtual directory to
    c:/tomcat4.1/webapps/mysite, as then this circumvents JK2 and doesn't
    use apache.

    So is this a limitation of JK2 that you can't ever intercept something
    at the root path of your webserver and then forward it to a different
    context?

    I tried:

    [urn:/]
    context=/mysite/

    But unfortunately it never got picked up.



    Btw as anyone successfully managed to get JNI channels working with
    apache/tomcat? THe closest I got was an error message saying that it
    needed some jni libraries in the java-library-path. I added a dll, but
    still no joy......


    Original Mesage:



    I've successfully set up JK2, Apache HTTPD and Tomcat.
    My webapp it called mysite - I've set my workers.properties as
    [uri:/mysite/*].
    My site is called, say http://welcometomysite.com.

    In order to actually make mysite/index.jsp to appear when you go to
    http://welcometomysite.com, I used mod_rewrite and added a directive:

    <Directory />
    Options FollowSymLinks
    AllowOverride AuthConfig
    RewriteEngine on
    RewriteRule / /mysite/ [L]
    </Directory>

    However, when I go to http://welcometomysite.com, the url is
    http://welcometomysite.com/mysite.

    Is there any way that I can disguise the URL so it never shows the
    web-app name?
    One considerations is that all my entries in my struts.config and jsp
    pages currently say /mysite/dosomething.do.

    Essentially, I'm looking for a solution where I never see my web-app
    name in my URL. Can anyone advise? I am an HTTPD newbie.

    Thanks

    Ben
     
    Ben Jessel, Jun 28, 2004
    #1
    1. Advertising

  2. In alt.apache.configuration Ben Jessel <> wrote:
    > So is this a limitation of JK2 that you can't ever intercept something
    > at the root path of your webserver and then forward it to a different
    > context?


    Sure you can. Just put your webapp in the ROOT context of the
    application server. But then you can have ONE context only. While most
    of the time what you want is to have MANY context.

    Davide

    --
    | Academic politics is the most vicious and bitter form of politics,
    | because the stakes are so low. -- Wallace Sayre
    |
    |
     
    Davide Bianchi, Jun 28, 2004
    #2
    1. Advertising

  3. Ben Jessel

    Chris Smith Guest

    Davide Bianchi wrote:
    > Sure you can. Just put your webapp in the ROOT context of the
    > application server. But then you can have ONE context only. While most
    > of the time what you want is to have MANY context.


    I don't see this at all. I see that the servlet specification is
    written from the perspective of having multiple contexts, but this is
    mostly an annoyance that can be worked around.

    (And, of course, it's quite possible to have a root context plus several
    contexts mapped to subpaths, so long as the root context doesn't use
    URLs that begin with the path of the subcontext.)

    --
    www.designacourse.com
    The Easiest Way to Train Anyone... Anywhere.

    Chris Smith - Lead Software Developer/Technical Trainer
    MindIQ Corporation
     
    Chris Smith, Jun 28, 2004
    #3
  4. In alt.apache.configuration Chris Smith <> wrote:
    > (And, of course, it's quite possible to have a root context plus several
    > contexts mapped to subpaths, so long as the root context doesn't use
    > URLs that begin with the path of the subcontext.)


    Hummm... wouldn't that be a mess with which-context-load-first his own
    libraries? If you have specific libraries for specific context of course.

    Davide


    --
    | The Third Law of Photography: If you did manage to get any good shots,
    | they will be ruined when someone inadvertently opens the darkroom door
    | and all of the dark leaks out.
    |
     
    Davide Bianchi, Jun 28, 2004
    #4
  5. Ben Jessel

    Chris Smith Guest

    Davide Bianchi wrote:
    > In alt.apache.configuration Chris Smith <> wrote:
    > > (And, of course, it's quite possible to have a root context plus several
    > > contexts mapped to subpaths, so long as the root context doesn't use
    > > URLs that begin with the path of the subcontext.)

    >
    > Hummm... wouldn't that be a mess with which-context-load-first his own
    > libraries? If you have specific libraries for specific context of course.


    Not sure what you mean. Each context will operate within its own
    classloader, per the spec. There will be no relationship between the
    classes available in the root context and any other context.

    --
    www.designacourse.com
    The Easiest Way to Train Anyone... Anywhere.

    Chris Smith - Lead Software Developer/Technical Trainer
    MindIQ Corporation
     
    Chris Smith, Jun 28, 2004
    #5
  6. Ben Jessel

    marcus Guest

    I believe the difference is setting up your rewrite engine to proxy
    through instead of URL rewrite. (I believe) As a proxy the client is
    not made aware of the change, which is typical of load balancing servers
    and stuff, but rewriting sends a "moved" header or something. I don't
    remember why I went the rewrite route, but I think the proxy set-up is a
    little more involved.



    There used to be some fabulous articles on the apache.org site.

    Ben Jessel wrote:
    > Thanks for everyone's input.
    >
    > However, I'm a little concerned that there's not a quick and easy
    > apache way of doing this; what do commercial users do? I'm sure that
    > there must be an apache way of doing this! Could it be done with
    > virtual hosting or aliasing?
    >
    > Its a pity that you can't just define a virtual directory to
    > c:/tomcat4.1/webapps/mysite, as then this circumvents JK2 and doesn't
    > use apache.
    >
    > So is this a limitation of JK2 that you can't ever intercept something
    > at the root path of your webserver and then forward it to a different
    > context?
    >
    > I tried:
    >
    > [urn:/]
    > context=/mysite/
    >
    > But unfortunately it never got picked up.
    >
    >
    >
    > Btw as anyone successfully managed to get JNI channels working with
    > apache/tomcat? THe closest I got was an error message saying that it
    > needed some jni libraries in the java-library-path. I added a dll, but
    > still no joy......
    >
    >
    > Original Mesage:
    >
    >
    >
    > I've successfully set up JK2, Apache HTTPD and Tomcat.
    > My webapp it called mysite - I've set my workers.properties as
    > [uri:/mysite/*].
    > My site is called, say http://welcometomysite.com.
    >
    > In order to actually make mysite/index.jsp to appear when you go to
    > http://welcometomysite.com, I used mod_rewrite and added a directive:
    >
    > <Directory />
    > Options FollowSymLinks
    > AllowOverride AuthConfig
    > RewriteEngine on
    > RewriteRule / /mysite/ [L]
    > </Directory>
    >
    > However, when I go to http://welcometomysite.com, the url is
    > http://welcometomysite.com/mysite.
    >
    > Is there any way that I can disguise the URL so it never shows the
    > web-app name?
    > One considerations is that all my entries in my struts.config and jsp
    > pages currently say /mysite/dosomething.do.
    >
    > Essentially, I'm looking for a solution where I never see my web-app
    > name in my URL. Can anyone advise? I am an HTTPD newbie.
    >
    > Thanks
    >
    > Ben
     
    marcus, Jun 29, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anders Skar
    Replies:
    3
    Views:
    898
    Anders Skar
    Feb 26, 2004
  2. Andrew
    Replies:
    7
    Views:
    447
    Andrew
    Jun 28, 2009
  3. wojciech777
    Replies:
    0
    Views:
    535
    wojciech777
    Nov 5, 2011
  4. MegaC
    Replies:
    3
    Views:
    537
    Brian Helterline
    May 24, 2004
  5. Roy M

    mod_perl in Apache httpd

    Roy M, Oct 16, 2008, in forum: Perl Misc
    Replies:
    0
    Views:
    91
    Roy M
    Oct 16, 2008
Loading...

Share This Page