Forum

Regex pattern reverse proxy

Martijn
11 February 2013, 19:50
Hi.

I need some help with the regex pattern for the reverse proxy feature.
What patterns are supported?
This one gives an error: ^.*\.(?!jpg$|png$)[^.]+$

What I want to achieve is that i.e jpg and png files are not forwarded to the host defined in the reverse proxy line.

Hiawatha version: 8.8-beta
Operating System: Debian Squeeze
Martijn
11 February 2013, 22:18
Found it in the source code.

regcomp with POSIX.
Martijn
13 February 2013, 18:50
The regex pattern, to what part of the URL is it applied to?

Example:
http://www.example.com/index.php

Is the full url tested (http://www.example.com/index.php)? Or only the part after / (/index.php)?
Hugo Leisink
13 February 2013, 18:57
The part after the hostname, so in your example: /index.php
Martijn
13 February 2013, 20:18
Thanks.

I think I finally completed my regex to forward empty url parts, php files and slugs (wordpress) to the reverseproxy.
And the rest served via Hiawatha (.js, .css etc)
It works with the default posix regex, so that's great.

ReverseProxy (^\/$|^\/.*\.php.*$|^\/([a-z0-9-]+\/?)*$) http://127.0.0.1

If you have any tips or improvements, I'll be happy to hear them.
This topic has been closed.