Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My clients sends requests to http://localhost:80/test/string. However my processing unit is at http://localhost:9080/servlet/Endpoint?req=test.

I want this redirection to take place transparently of the client. My client should take the response from http://localhost:9080/servlet/Endpoint?req=test still believing that the response came from http://localhost:80/test/string.

How can be done? Is it possible to do it using a proxy server?

share|improve this question
    
What you need is a reverse-proxy, not a redirect. –  sybreon Nov 8 '10 at 3:13
add comment

migrated from stackoverflow.com Nov 8 '10 at 0:14

This question came from our site for professional and enthusiast programmers.

1 Answer

An other solution is that you setup a reverse proxy with apache with proxy_http module (included by default):

the config file should be something like:

ProxyRequests off
ProxyPass / http://localhost:9080/
ProxyPassReverse / http://localhost:9080/

Then play with mod_rewrite.

share|improve this answer
    
ProxyPass does not work with the Question Mark character. Please bare in mind that the URL is changing not only the port –  cateof Nov 7 '10 at 12:45
    
I was about to apology, but I've just checked on one of my website where I use a reverse proxy for redmine (I run a standalone redmine server on port 3000). The search works perfectly with myreverse.com/search?q=projectname –  aif Nov 7 '10 at 12:51
    
I assume that you are using you string as a pattern and not as a substitution string. I am using ProxyPass pattern subs?q=test and the tomcat returns that %3Fq=test is not found (? is encoded as %3F) –  cateof Nov 7 '10 at 13:07
    
I'm not sure I understand what you mean. The ?q is used as a GET argument for the search form, and it works fine. –  aif Nov 7 '10 at 16:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.