Forum

Order ReverseProxy / UrlToolkit

Heiko
30 March 2013, 16:38
Hi Hugo,

when I use a static site like hugo.html and want to redirect to hugo.cgi, I could try two ways:

1.)
UrlToolkit {
ToolkitId = translate_url
Match ^/hugo.html Rewrite /cgi-bin/hugo.cgi
}

VirtualHost {
...
UseToolkit = translate_url
ReverseProxy /cgi-bin http://localhost:8080
}


2.)
VirtualHost {
...
ReverseProxy ^/hugo.html http://localhost:8080/cgi-bin/hugo.cgi
}

Way 1 is 404.

Way 2 is working. But in Browser I see http://testdomain.com/cgi-bin/hugo.cgi
and I want to see: http://testdomain.com/hugo.html

I think I know, why Way 1 is not working. Hiawatha is using the ReverseProxy before it is translating the URL ins the Toolkit.

But I need it in this way, because the ReverseProxy is a Apache with mod_perl. I can't change all the Perl-Scripts to fast-cgi.
And mod_perl is much faster than plain cgi in hiawatha.

I think there is no way to change the order: ReverseProxy <--> translate_url ?
Maybe the is an undocumented order switch?

Maybe there is a possibility to implement an order_switch?

Thanks for feedback.

Greetings Heiko

Hiawatha version: 9.0
Operating System: OpenBSD 5.2 / Ubuntu 12.04
Hugo Leisink
30 March 2013, 17:51
The reverse proxy is indeed handled before the URL rewriting. What you can do is let Apache rewrite the URLs. That should still be possible, even if it is using mod_perl.

You say that via 'way 2' you see /cgi-bin/hugi.cgi instead of /hugo.html. I don't understand why, because the reverse proxy is not redirecting anything. It just forwards the request and sends back the answer. The URL in the browser stays the same. I want to see for myself what happens. Do you have an example URL for me?
Heiko
30 March 2013, 18:47
Thanks Hugo.
I tryed way 2 again, maybe it was a caching problem. Sorry you are right.
VirtualHost {
...
ReverseProxy /cgi-bin http://localhost:8080
ReverseProxy ^/hugo.html http://localhost:8080/cgi-bin/hugo.cgi
}

In this way I can use hugo.html and /cgi-bin/hugo.cgi
Thats great.

Rewrite by Apache is not the best solution, because Hiawatha is the security frontend
Way 2 is the solution.
I understand thats better for the "server-load", when the proxy is rewriting. But a order_switch would be nice too
Thank you.
This topic has been closed.