Forum

Webproxy rewrite rules

Roman
9 May 2014, 19:15
Hi, Hugo!

I'm trying to setup your Webproxy. I want to hold all the files in /proxy folder on my vps (https://example.net/proxy/).

My config is:
UrlToolkit {
ToolkitID = webproxy
Match /proxy/.* Rewrite /proxy/index.php
}

It doesn't work. It shows Webproxy's page template with 404 error instead of content.
Is it possible to get is working in /proxy folder? I do not want to create a subdomain for the proxy.

Thank You!

Hiawatha version: 9.5
Operating System: CentOS 6.5
Hugo Leisink
9 May 2014, 21:02
Running the reverse proxy in a subdirectory is not supported and can't be done via UrlRewrite. What you need is to rewrite (.*) to /proxy/$1. But that makes any other file in the root or other subdirectory inaccessible.
Roman
11 May 2014, 19:27
That didn't help. I decided to create a subdomain, added dns record, edited config like this:

UrlToolkit {
ToolkitID = webproxy
Match .* Rewrite /index.php
}
VirtualHost {
Hostname = proxy.domain.net, *.proxy.domain.net
WebsiteRoot = /var/www/proxy.domain.net
StartFile = index.php
ExecuteCGI = yes
UseToolkit = webproxy
}


The application shows its front page. I type into the input field, for example, yandex.ru.
The browser gets redirected to yandex.ru.proxy.domain.net but appearently can't resolve the URL.
Is my config right?
Should I do something with DNS?
Hugo Leisink
11 May 2014, 20:43
Config looks ok. What you need is a DNS wildcard setting. Not only proxy.domain.net, but also *.proxy.domain.net must resolve to your IP address.
Roman
12 May 2014, 09:58
Everything works. Thank you!
This topic has been closed.