Forum

ReverseProxy and Rewrite at the same time

Odd-Jarle
22 July 2013, 21:29
I'm wondering if this is at all possible with Hiawatha:

I want a reverse proxy which accepts only a few URLs and forward them to a backend webserver. For one of the URLs I want to perform a rewrite of the URL as well.

http://10.1.2.3/site2/myimage.jpg should be rewritten to http://192.168.1.10/another/site2/myimage.jpg
http://10.1.2.3/site3/something should forward the request to http://192.168.1.20/something

In the last example I want to remove the site3 from the URL before requesting that URL from the backend.

I've managed to get the first part to work perfectly. And I believe I've made is the correct Rewrite Toolkit for the last 2nd example. But I am unable to get the requests forwarded to the backend of the 2nd example.

Hiawatha version: 9.1
Operating System: CentOS 6.4
Odd-Jarle
22 July 2013, 21:30
I was unable to post all this in one post.

My hiawatha.conf (excerpt):

UrlToolkit {
ToolkitID = site3
Match ^/site3/(.*) Rewrite /$1
}

VirtualHost {
Hostname = 10.0.0.1
UseToolkit = site3
ReverseProxy ^/site1/ http://192.168.1.10/site1/
ReverseProxy ^/site2/ http://192.168.1.10/site2/
ReverseProxy ^/site3/ http://192.168.1.20/
}
Odd-Jarle
22 July 2013, 21:32
Sorry about the typo in the first example. It should be:

http://10.1.2.3/site2/whoever -> should forward the request to http://192.168.1.10/site2/whoever
Hugo Leisink
22 July 2013, 22:22
Hiawatha doesn't support rewriting URLs which are to be proxy'd to another webserver. I believe that to be a job of that other webserver.
Odd-Jarle
23 July 2013, 13:14
Ok, thanks for clarifying that
This topic has been closed.