Apache + JK + Tomcat: Redirecting specific URL to a servlet

Hi, everybody!
I'm searching for a solution to my question for some time, but didn't find anything clear enough.
So, my situation is:
I have Apache 2.2 and Tomcat installed on my server. Apache is using JK Connector to send request to Tomcat.
What do I need:
I have a servlet that could be accessed through "http://mydomain.com/site/*". I can access, through this servlet, any of the site's sections. Like http://mydomain.com/site/news, http://mydomain.com/site/movies or http://mydomain.com/site/tech.
I need to figure out a way of pointing one URL to each of these sections, but without changing the user URL. In other words, I have the domains www.mynews.com, www.mymovies.com and www.mytech.com, and would like that each one of these domains redirect to their respective servlet.
So, is there a way of accomplish this task?
Thank you,
CaioToOn!

Hi!
I'm already mapping the final part of the URL. eg: "news", "tech".
What I need is a way of mapping a domain to a sub-url, but avoiding changes on the user's browser url.
I'm searching for a few days on the Tomcat manual, Apache manual and forums, but nothing like what I need 'til now. I'm still searching, but if someone there already know, I'll be very happy! I got kind of urgency.
Thank you, again!
CaioToOn!

Similar Messages

  • Redirect Root Url to Specific App

    Hi everybody,
    I like to auto redirect my apex server url to a specific app. I am using an XE 11.2 Linux with embedded Gateway.
    Redirect from http://80.228.224.61/ to http://80.228.224.61/apex/f?p=100
    ,so that the App is called directly - actualy I see the Index of - XDB?
    So how I place a index.html with a redirect at url root - or is there an more elegant way?
    regards
    Ralf

    Hi,
    the point is - I would like to enter the domain directly - it looks awful when I enter the ip (later the domain) an I am getting :
    Index of /
    Name
    Last modified
    Size
    images/ Wed, 26 Oct 2011 13:20:38 GMT
    images_201110261519/ Wed, 26 Oct 2011 13:19:23 GMT
    public/ Tue, 22 Mar 2011 16:54:00 GMT
    sys/ Tue, 22 Mar 2011 16:55:05 GMT
    On my internal Servers I had handled this by making a simple redirect via the linux apache (Port 80) to an OHS (Port 7780 or 8080) - but this wont work here - cause I have to handle this all on Port 80.
    The actual view to this domain is always a redirect to port 8081 (http://www.pflege-los.de -> http://web.landkreis-oder-spree.de:8081/apex/f?p=100). This causes mainly problems - cause if there are people behind a proxy (most only forward 80 / 443 / 8080) they wont get access and google will grab all data to the server not the domain. So I have already an crutch ;-) ...
    I managed to get an Port 80 redirect from our sysadmin. So there is only a little step left ;-) befor I can move the domain to this ip ...
    I would like to have an clean way. If I have to - I will give the OHS a try - but it will be difficult to convince the sysadmin to install the OHS ;-) ...
    regards
    Ralf
    PS: the "regular" apache is always in use on this server - i dont have the ability to use it!
    Edited by: Ralf M. on 24.09.2012 14:54

  • Apache with Tomcat cluster

    Hi, I integrated Apache with Tomcat Cluster on Windows 2000. I instalated mod_jk2.dll, created workers2.properties and configurated server.xml in Tomcat instances. If I try to reach my .jsp file, e.g. http://localhost/root/main.jsp, I get follow message from Tomcat: source root/main.jsp is not available. What�s wrong? Can anybody help me? Apache version: 2.0.47, Tomcat: 1.4.27

    Well, the first order of business is to determine exactly where main.jsp is located. If it is at <CATALINA_HOME>/webapps/main.jsp, then it should be at http://localhost:8080/main.jsp. Bypass Apache and verify that you can get to the Tomcat specific pages first.
    Basically, we're trying to determine a) the correct URL and b) whether the problem is with Tomcat itself, or with the connections between Apache and Tomcat.
    Essentially, we can't tell you where your configuration is incorrect until you tell us what your configuration is. :)

  • Tomcat redirection

    When deploy web application to tomcat 5.5.9, if I type www.myhost:port/myapplication, then browser will display the application's directory.
    How do I redirect the URL to a specific index.jsp file instead of displaying the directory ? So when I type www.myhost:port/myapplication and then it automatically redirect to:
    www.somedomain.com/myapplication/jsp/index.jsp.

    Put an index.jsp or index.htm in your application root directory that does the redirect for you.

  • Apache/SSL Tomcat config weirdness...

    I thought I read a post related to this recently, but I can't find it (the forum search is flaky lately), so I'm making my own post...
    We have Apache 1.3 with mod_ssl for SSL, Tomcat 4.1.24 and mod_jk set up. Things work fine for most of this setup, except this weird thing happening with our pushlet servlet. The pushlet is a servlet that never closes and we push data to an applet client in the browser.
    The JSP and other servlets (one that creates a chart image, for example) work fine. The weird thing is the pushlet servlet, on the other hand, will not work fine. It has multiple output modes: Javascript, Serialized Object and XML, and we use the Serialized Object mode with the client applet, but for some reason it is disregarding what mode we ask for only when using SSL. When we connect to Tomcat directly (we have port 8080 open for testing) without SSL, the pushlet stuff works fine as well. It seems that when we connect to the pushlet (testing by typing the URL in the browser) with SSL, it defaults to the Javascript mode no matter what we put in the query string of the URL, and Javascript not being serialized objects, the client barfs. (XML mode doesn't work either.)
    It's made more weird because the debug statements we put in the doGet method of the pushlet servlet don't get written either in SSL mode, but they do in non-SSL mode. Very strange, cuz basically we figured the pushlet servlet is somehow not getting the parameters of the query string in the request (which is what I thought I saw a thread about that I mentioned before).
    So clearly the obvious answer is that something isn't configured correctly between Apache and Tomcat. But I can't seem to figure out what. Any ideas?

    I wouldn't say most... you've been pretty busy yourself...
    One possible conclusion we've come up with is: We are using RedHat Linux 9, and I rebuilt Apache, mod_ssl and mod_jk myself on that system. But someone else installed it, and I recall (vaguely, and the someone else no longer around) that he had some issue running them with the mod_jk I built for RH9, so he ended up using the one we had from a RH7.2 installation (which the whole thing on a RH7.2 system works fine, SSL or not). He had said it was working with the RH7.2 mod_jk, but maybe he didn't check the right things, and I didn't follow up on it at the time cuz it wasn't important at the time.
    So the thought is that maybe it's the mod_jk that's really causing a problem for some reason. Some incompatability in the builds for the OS versions. Why it's only during SSL connections, I don't know, but the rest of the config seems to be correct.
    As for the SSL How-To, yes, I've looked thru it again (as I said, though, we have the same thing on an RH7.2 system is working fine, and in both cases I built Apache, mod_ssl and mod_jk from source for both systems). I'm considering setting up stand-alone SSL on Tomcat and taking Apache out of the loop to see if it works that way.
    We have, however, pretty much ruled out the pushlet servlet (it's 3rd party code) as the problem. We have the source, and it's too simple in what it does to be messed up, and debug statements we put in don't seem to indicate any problem.
    Well, more investigations tomorrow.

  • Apache + 2 Tomcats session replication problem.

    Greetings everyone.
    Before stating the problem, let me explain how my environment is set.
    I have two machines. One (PC1) running Apache (HTTP server 2.0.58)
    and one instance of Tomcat (5.0.28) and another machine (PC2) with
    another instance of Tomcat(5.0.28).
    The Apache server
    It is configured to handle static content, to redirect dynamic content to a
    Tomcat instance through AJP 1.3 connector.
    This process is done through the mod_jk and the workers.properties
    The workers.properties file is configured to have sticky_session = True
    so it assigns a SESSION_ID to the same Tomcat it was first assigned.
    The workers.properties file is configured to have
    sticky_session_force = True so if the Tomcat the SESSION_ID was
    assigned is not available, the server answers with a 500 error.
    The Tomcat servers
    Both have only the AJP 1.3 connector enabled
    Both have the Cluster tag from the server.xml file uncommented
    and the useDirtyFlag flag set to false, for not to allow SESSION
    replication between Tomcats.
    The workers.properties file
    workers.apache_log=C:/Apache2/logs
    workers.tomcat_home=C:/Tomcat5
    workers.java_home=C:/j2sdk1.4.2_13
    ps=/
    #Defining workers -----------------------------
    worker.list=balancer,jkstatus
    #Defining balancer ---------------------------
    worker.balancer.type=lb
    worker.balancer.balance_workers=tel1, tel2
    worker.balancer.sticky_session=True
    worker.balancer.sticky_session_force=True
    worker.balancer.method=B
    worker.balancer.lock=O
    #Defining status -----------------------------
    worker.jkstatus.type=status
    worker.jkstatus.css=/jk_status/StatusCSS.css
    #Workers properties ---------------------------
    worker.tel1.type=ajp13
    worker.tel1.port=8009
    worker.tel1.host=127.0.0.1
    worker.tel1.lbfactor=1
    worker.tel1.socket_keepalive=False
    worker.tel1.socket_timeout=30
    worker.tel1.retries=20
    worker.tel1.connection_pool_timeout = 20
    #worker.tel1.redirect=tel2
    worker.tel1.disabled=False
    worker.tel2.type=ajp13
    worker.tel2.port=8009
    worker.tel2.host=199.147.52.181
    worker.tel2.lbfactor=1
    worker.tel2.socket_keepalive=False
    worker.tel2.socket_timeout=30
    worker.tel2.retries=20
    worker.tel2.connection_pool_timeout = 20
    #worker.tel2.redirect=tel1
    worker.tel2.disabled=False
    THE PROBLEM
    I open a browser in the jk-status page to see how the Tomcat instances are
    working, and both are working fine: Stat -> OK, now as the
    loadbalancing factor is 1 on both Tomcats, an even alternating session
    distribution is set.
    While this browser is open to keep an eye on the status, I open a new
    browser (B1)to connect to my Web Application, Apache answers
    correctly and gives me a SESSION_ID for Tomcat instance 1 [both
    instances are OK], if I make a simple refresh, my SESSION_ID is still the
    same so I'm assigned to Tomcat instance 1 but this time I get an
    ERROR 503 - Service unavailable but looking at the status of the
    Tomcat instances both instances are still OK, no-one is down. And it
    stays throwing this error for as many refreshes i do.
    Now, I open a new browser (B2)and do the same process as before,
    as expected, Apache now gives me a SESSION_ID for Tomcat instance 2,
    repeating the same refreshing process, the error is thrown again, but still at
    the jk-status page, both instances are fine.
    Without closing these windows, I make a new refresh try on B1 and
    even though the jk-status says both Tomcat instances are OK, the error
    is still thrown. I open a third one (B3), and Apache again, correctly
    gives me a new SESSION_ID for Tomcat instance 1 and answers
    correctly on the first call. But once again if i repeat the refreshing process, the
    error is thrown again.
    Note: Using a different resolution to always keep and eye on the
    instances status and using a refresh rate of 1 second for status, both
    servers always were OK.
    So the main problem is that somehow when the session is replicated
    to the same tomcat, Apache confuses and thinks it is not available, when
    asking it through the jk-status it tells it is OK
    I've been trying different configurations with both Apache and Tomcat,
    but there must be something missing since I don't get it to work correctly
    Thanks in advance for all your helping comments.
    - @alphazygma

    Whew... that was quite an answer... definitely is going to help him a lot. Yeah any n00b by now should know how to use google, but that's not the point in this forums, here we are to help each other. and wether you like it or not many of us deploy applications to tomcat and stumble on this. So dont try to be cool posting this kind of answers like google this or google that if you dont have an answer please dont comment you will appear to be more noobish than you aparently are.
    Well enough talking.
    I found the following useful: (it comes in the server.xml of the tomcat configuration)
    <!-- You should set jvmRoute to support load-balancing via JK/JK2 ie :
    <Engine name="Standalone" defaultHost="localhost" debug="0" jvmRoute="jvm1">
    -->
    Enabling that entry on both machines should be enough.
    Aparently the problem is not with apache. is with tomcat since it can't retain the session apache gives.
    more information in the Tomcat help at:
    http://tomcat.apache.org/tomcat-5.0-doc/balancer-howto.html#Using%20Apache%202%20with%20mod_proxy%20and%20mod_rewrite

  • Apache with Tomcat and dispatcher class.

    I have a MVC design set up with a controller and dispatcher class. I am trynig to forward the results to a specific JSP. If I run the design completely within Tomcat, then everything works great. I have a tomcat site set up called /jsp. My servlet is within the jsp site. So if I do http://localhost:8080/jsp/mypage.jsp it will bring up the page fine. I then submit to and action of /myservlet?action=test. The servlet/dispatcher classes process and forward the request to "/jsp/mypage_result.jsp". All is fine and dandy.
    However, when I try to run this through Apache first let the MOD_JK2 send the JSP/servlet requests to Tomcat the dispatcher doesn't work. I alway get the ERROR 404 page within tomcat (see note 1 below). Even if I use a "./mypage_result.jsp", because the pages are in the same directory, I still the get the error. Can anyone help?
    What I think is happening is that when I make the inital request of http://localhost/jsp/mypage.jsp the request gets sent to Tomcat from Apache. Tomcat processes the jsp page and displays the result to the client. The user submits the data to the servlet (through Apache which pushes it to Tomcat). The servlet/dispatcher code runs and then gets ready to forward the request on. Where I get confused or I am completely guessing is that when the forward method gets called. Does it forward the request on as a HTTP request or as a request within Tomcat? I would guess it is an http request and the request comes in through Apache which (depending on the worker2.properties file) will or will not forward the request to Tomcat. This is where the problem happens. On this forward in the dispatcher class.
    Please help.
    NOTE 1:
    HTTP Status 404 - /mypage_result.jsp
    type Status report
    message /mypage_result.jsp
    description The requested resource (/mypage_result.jsp) is not available.
    Apache Tomcat/4.1.24

    After reading the documentation for the getRequestDispatcher method it seems that the file you are forwarding to must be in the same context. Well if it is in the same context within Tomcat, does it mean it is the same when I am trying to use Apache?
    Anyone out there go this to work?
    Thank you in advance for reading my post.

  • Apache Tomcat 4 error - cant fine a servlet

    Hi,
    I have a web.xml file that defines classes and url patterns fine. For some reason though, which I cant work out, even when I add the following to web.xml, Tomcat says it cant find the requested resourse.
    http://localhost:8080/servlet/SimpleShoppingBasket
    <servlet>
    <servlet-name>SimpleShoppingBasket</servlet-name>
    <servlet-class>SimpleShoppingBasket</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>SimpleShoppingBasket</servlet-name>
    <url-pattern>/servlet/SimpleShoppingBasket</url-pattern>
    </servlet-mapping>
    The error displayed is:
    HTTP Status 404 - /servlet/SimpleShoppingBasket
    type Status report
    message /servlet/SimpleShoppingBasket
    description The requested resource (/servlet/SimpleShoppingBasket) is not available.
    Apache Tomcat/5.5.17
    Every other servlet I have runs fine except this one. I have checked the spelling of the class and it is correct. I am nearing my wits end!
    Please help! What could be wrong? Is there a cache that I can delete somewhere maybe?

    Try putting the servlet class into a package. There could be access problems with it being in the "unnamed" package
    Check the tomcat logs for any errors that servlet may be creating ([TOMCAT]/logs directory)
    Also is your web app installed in the ROOT directory or in its own context?
    If in its own context then the url would be http://localhost:8080/mycontext/servlet/SimpleShoppingBasket
    What do the other (working) servlet definitions look like?
    How are they different from this one?

  • Can Apache plug-in redirect lookup of EJB?

    Apache plug-in can redirect URLs. I have setup the Apache plug-in to redirect initial context calls to the WLC host and successfully obtained an initial context via this redirection. I received an error when I attempt a lookup of a deployed EJB if the provider URL used in the lookup is that of the Apache plug-in instead of the WLC host. When I invoked the initial context's lookup the following error occurred:
    javax.naming.NameNotFoundException: Unable to resolve com.harris.netboss.shared.
    service.ServiceRegistrarHome Resolved: '' Unresolved:'com' ; remaining name 'har
    ris.netboss.shared.service.ServiceRegistrarHome'
    at com.harris.netboss.shared.comm.connector.EJBConnect.connect(EJBConnec
    t.java:151)
    at test.com.harris.netboss.shared.comm.connector.EJBConnectTester.<init>
    (EJBConnectTester.java:24)
    at test.com.harris.netboss.shared.comm.connector.EJBConnectTester.main(E
    JBConnectTester.java:41)
    The Apache plug-in is obviously not redirecting a lookup to the WLC. Has anyone ever used the Apache server to redirect **BOTH** initial context and lookup?
    Thank you.

    Apache plug-in can redirect URLs. I have setup the Apache plug-in to redirect initial context calls to the WLC host and successfully obtained an initial context via this redirection. I received an error when I attempt a lookup of a deployed EJB if the provider URL used in the lookup is that of the Apache plug-in instead of the WLC host. When I invoked the initial context's lookup the following error occurred:
    javax.naming.NameNotFoundException: Unable to resolve com.harris.netboss.shared.
    service.ServiceRegistrarHome Resolved: '' Unresolved:'com' ; remaining name 'har
    ris.netboss.shared.service.ServiceRegistrarHome'
    at com.harris.netboss.shared.comm.connector.EJBConnect.connect(EJBConnec
    t.java:151)
    at test.com.harris.netboss.shared.comm.connector.EJBConnectTester.<init>
    (EJBConnectTester.java:24)
    at test.com.harris.netboss.shared.comm.connector.EJBConnectTester.main(E
    JBConnectTester.java:41)
    The Apache plug-in is obviously not redirecting a lookup to the WLC. Has anyone ever used the Apache server to redirect **BOTH** initial context and lookup?
    Thank you.

  • Redirect to url after flash video completes

    I've embedded a .flv file using Insert/media/flash video in
    DW 8.02. Is there some way I can get it to redirect to a specific
    url once the movie completes?
    The only options currently seem to be stop/rewind.
    Thanks,
    Rashid.

    RashidK wrote:
    > I've embedded a .flv file using Insert/media/flash video
    in DW 8.02. Is there
    > some way I can get it to redirect to a specific url once
    the movie completes?
    >
    > The only options currently seem to be stop/rewind.
    >
    > Thanks,
    >
    > Rashid.
    >
    you have to set this up in the flash file (in ActionScript).
    when it reaches the end:
    getURL("redirectpage.html");
    seb ( [email protected])
    http://webtrans1.com | high-end web
    design
    Downloads: Slide Show, Directory Browser, Mailing List

  • Button that does not redirect to url

    can i create button that does not redirect to url
    to perform a function or action on page, for instance
    i want button to call plsql function but not redirect
    Message was edited by:
    windo

    Hi,
    Yes you can...
    When you create the button, don't set anything for the page / URL redirect. Then go to your pl/sql process definition and set it to fire "when button pressed..." Finally, just make sure you either have a branch set, as a default, redirecting back to your current page or create a branch specifically for "when button pressed..." as well. I usually create a default branch back to the current page for any page that can be submitted with a sequence of 999 (and no conditions) so that it is (usually) the last redirect that is evaluated. This will always save the error "No page to redirect to..." and also saves creating a bunch of unnecessary branches
    Hope this helps,
    Mike

  • Right problem with apache and tomcat

    Bonjour;
    I use a user login "apache" to stop/start Apache and tomcat. Because never launching apache et tomcat as root.
    But I have the following problem with apache (file error.log) :
    [Tue May  6 17:26:22 2003] [error] Connection "warpConnection" cannot connect
    [Tue May  6 17:26:22 2003] [error] Cannot open connection "warpConnection"
    [Tue May  6 17:27:01 2003] [error] Re-Trying to deploy connections
    As root the error msg does'nt exists (lost)
    Best regards;
    A+;

    Run it from the shell to see whats wrong:
    # httpd

  • I have been putting in a URL and yahoo snags it parses it to several words then gives me a search page... I use Google for search andf I want to go to the specific URL I entered... How do I block Yahoo from doing this crap?

    I use google for my search engine. I do not have any reference to Yahoo in my plugins or extensions on Firefox. Every time I enter a specific URL in the Firefox box, Yahoo comes up, has the full URL I entered to go directly to. It has the URL in the Yahoo search entry field and it parses the name to several words that make up the entire URL. Asks me if I only want the name I entered and lists every site that contains the words it parses... Yahoo is really screw up if it hijacks the browser. How do I prevent them from doing this...

    Hi,
    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!

  • Apache 2, Tomcat 5, mod_jk2 configuration problem

    I am setting up a Web Server on a RedHat Enterprise Linux box. I installed the RedHat Application Server that installs Apache 2, Tomcat 5 and Mod_JK2. I can't get the mod_jk2 configured properly. I've searched the internet and haven't found any documentation that will work with this.
    I need to know how to configure the mod_jk2 with Apache2 and Tomcat 5.
    PLEASE HELP!!! Nothing I've tried from the Internet has helped. The best site that I've found is ::
    http://www.johnturner.com/howto/apache2-tomcat4127-jk-rh9-howto.html
    but its for tomcat 4 so it doesn't work for me.
    Has anyone does this before that can help me????
    Thanks in advance.

    Ended up downloading and installing the mod_jk instead of the mod_jk2 that came with RedHat Application Server.

  • Which is better for servers, Apache or Tomcat?

    Which is better for servers, Apache or Tomcat?

    For some reason that link I gave you isn't working right now, but it was today, weird. I would get Tomcat simple because sun uses it in its examples and recommends it. Here's sun's link then, it's probably more useful anyway. http://java.sun.com/products/jsp/

Maybe you are looking for

  • Issue at start (MBP Retina late 2013)

    Hi everyone, I have some little issues with my MBP: after the start it takes about 18 seconds to show the files in the folder. No coloured wheel, I just have to wait. Is this normal? Sorry for my bad english and thanks! Luca

  • Question on Dynamic Select Lists and Checkboxes

    Hello, I am new to APEX, and this is my first posting, I have a question about how to implement dynamic checkboxes from a select list. Basically I would have a select list, and based on what item is selected a set of checkboxes would appear. I was or

  • Aleternative account no historical information

    We have Alternative Accounts defined at Chart of account level ( COA A). These alternative accounts, have been assigned to our operating GL accounts defined under Operative Chart of Accounts ( COA B). Our Cleint is expected to see the Line item infor

  • DMP - Accessing other Fonts

    Working on some web page feeds into my DMP's. I am not having any luck in changing either the font size or the font style. I can see how to change the font size for a static text but not the font style. I also want to choose a font size and style for

  • Can't change cookies setting in 5.1

    When I change the cookies setting in Safari prefs, it won't take.  Such as Always to Never block or the other way around.   I have to quit Safari and re-open to make the change take effect.   RR