• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Redirect Request from Apache to Tomcat

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have an application on Tomcat with the following two URLs for two components.

1. "http://mymac.com:8010/sys/503/DMART:Control+Panel/dt_type/?cacheid=79f8335b"

2. "http://mymac.com:8010/sys/503/IT%3APersonal+Info/Ad+View/?cacheid=78132f72"

On the same Host, I have /etc/host setup with these DNS

external.com
internal.com

I setup Apache HTTP Webserver

Can you let me know what configuration should i do in httpd.conf file so that

http://external.com shows me this app -> "http://mymac.com:8010/sys/503/DMART:Control+Panel/dt_type/?cacheid=79f8335b"

while

http://internal.com shows me -> "http://mymac.com:8010/sys/503/IT%3APersonal+Info/Ad+View/?cacheid=78132f72"

I have a good understanding of Apache and Tomcat but never done something like this.

Please suggest.

 
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know that you can set up anything in httpd.conf to make that happen. It sounds a perfect use case for mod_redirect, assuming that is installed, or that you can install it.
 
shifahim shif
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:I don't know that you can set up anything in httpd.conf to make that happen. It sounds a perfect use case for mod_redirect, assuming that is installed, or that you can install it.



This requirement seems to be very popular, so anyone like to put more light on this and help us know how can we achieve this ?
 
Ulf Dittmer
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's wrong with mod_redirect? It is a very popular solution.
 
shifahim shif
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:What's wrong with mod_redirect? It is a very popular solution.



Can you help me with some example test case which I can refer & seek help off and try at my end.
 
Ulf Dittmer
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is mod_redirect installed and enabled yet? If not, start with that. There's documentation at https://httpd.apache.org/docs/current/mod/mod_rewrite.html
 
shifahim shif
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:Is mod_redirect installed and enabled yet? If not, start with that. There's documentation at https://httpd.apache.org/docs/current/mod/mod_rewrite.html



Its enabled. Can you tell me which directive do i have to use to achieve what i wish to achieve ? Any sub section in that link and I should be good.
 
Ulf Dittmer
Rancher
Posts: 43026
76
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'd need a pair of RewriteCond/RewriteRule statements, one each for the two domains. Search for a mod_rewrite tutorial to get you started.
 
shifahim shif
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:You'd need a pair of RewriteCond/RewriteRule statements, one each for the two domains. Search for a mod_rewrite tutorial to get you started.



Inorder to achieve the above do I have to use the mod_jk.so connector and all the steps mentioned in the below link ?

http://www.ntu.edu.sg/home/ehchua/programming/howto/ApachePlusTomcat_HowTo.html
 
Ulf Dittmer
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mod_jk governs how an Apache integrates with a Tomcat. You may have to use it if you do that (the port 8010 that you used before indicates that you do not, but it's impossible to say from the information given), but it has nothing to do with the redirection we talked about here.
 
shifahim shif
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:mod_jk governs how an Apache integrates with a Tomcat. You may have to use it if you do that (the port 8010 that you used before indicates that you do not, but it's impossible to say from the information given), but it has nothing to do with the redirection we talked about here.



I used the below link to enable mod_rewrite

http://www.webdevdoor.com/php/mod_rewrite-windows-apache-url-rewriting/

I m not using mod_jk as of now becoz i am not sure if it is necessary. Using rewrite below is what I put in my httpd.conf of apache webserver.



When i hit external.com on the browser I don't see my application page but a blank page.

Can you help me understand if my configuration is incorrect.

 
Ulf Dittmer
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anything in the log files?
 
shifahim shif
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:Anything in the log files?



Here is the access log:



and here is the error log



Let me know if I need to share some more info.
 
A "dutch baby" is not a baby. But this tiny ad is baby sized:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic