* Added support for wildcard prefix in server patterns
This update introduces the ability to use a wildcard prefix in server patterns for domain matching. It also includes corresponding tests for this new functionality, ensuring "*.domain.com" style patterns can be handled correctly.
A host substitution functionality has been added to the match logic for the MTProxy match type. This allows for more flexible routing rules, enabling the replacement of "$host" and "${host}" placeholders in the destination URL with the server name, before performing the regex match. Updated corresponding tests to reflect this change.
make additional test without host substitution
add test with ${host} substitution
* Add 'X-Forwarded-URL' to request header
'X-Forwarded-URL' has been added to the request header in the proxy core to improve redirection handling.
* lint: address unused param warn, supress for tests
* Initial implementation of keep-host argument
* Add keep-host parsing to the consulcatalog provider
* Update docs
* update from the current master
---------
by @ffix
add new remote param to docker and file providers
lint: http nil body
add support of remote ips to consul provider
local implementation of onlyfrom middleware
lint: missing comment
make proxy tests more readable
preffer public IP if any forwwarded
Before this change redirects didn't work because method `Service.extendMapper` didn't copy
the value of `URLMapper.RedirectType` to the extended result.
To fix this we return the original `URLMapper` instead of creating a new one (it can also help
to avoid similar bugs in the future). We can reuse `URLMapper` because it is passed
by value.
Consider proxy configuration `*,/test/(.*),https://dest/$1`.
When reproxy accepts a request with URL encoded path, i.e.
'/test/a%205%25%20b/' which the encoded form of '/test/a 5% b',
it is using request.URL.Path which is already URL decoded by Golang.
This causes an error in proxy.go while it is trying to validate the
destination with `url.Parse(match.Destination)` as, strictly speaking,
destination URL is not a valid URL anymore, it is `https://target-dest/a 5% b`.
With this fix, the original escaped URL stays as is, correctly passes
the validation and then it is up to destination server to URL decode and
correctly handle the URL.
Main consideration is backward compatibility. example.com should be treated as an exact
match, where possible. So current order is: exact host, regex host, * or "".
Regex matches are cached for better performance, cache is invalidated once mappings are refreshed.
In some cases proxy should sanitize incoming headers. --drop-header and $DROP_HEADERS set list of headers (keys) and those headers removed from the request.
This is an attempt to address #108
Instead of dedicated support of header`s removal it allows to return a flag indicating plugin's full control over headers. With this flag set, the conductor won't mix response headers with originals but rather will count on a plugin to provide all the headers.