1
0
mirror of https://github.com/umputun/reproxy.git synced 2024-11-16 20:25:52 +02:00
Commit Graph

224 Commits

Author SHA1 Message Date
Umputun
1959706ab4 replace keep host with less verbose but more detailed dbg messages only if keep host is enabled 2024-07-23 11:27:58 -05:00
Umputun
85702e4de1 remove noisy keep host messages from logging 2024-07-23 11:25:40 -05:00
Umputun
5774737128 Handle default and concrete server match conflict #192
- Drop default server match if a concrete server match is found
- Add test case to validate behavior
2024-05-23 12:08:59 -05:00
Umputun
57552c1798
Added support for wildcard prefix in server patterns (#191)
* 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.
2024-05-23 01:56:58 -05:00
Umputun
d3bbec8818 prevent log access races in tests
suppress false postive linter warns
2024-05-21 22:51:41 -05:00
Umputun
271beedc99 Added host substitution in MTProxy match type #189
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
2024-05-21 22:51:41 -05:00
Dmitry Verkhoturov
899e101d7a add test to CI for example directory 2024-05-10 15:10:28 -05:00
Dmitry Verkhoturov
0a9e489743 update github.com/didip/tollbooth from v6 to v7 2024-05-09 13:16:40 -05:00
Umputun
e2ee5bab1b fix forwarded url, has to be earlier and constructed 2024-03-15 17:49:11 -05:00
Umputun
351de86a26 move setting X-Forward-URL after both scheme and host set 2024-03-15 17:32:33 -05:00
Umputun
d2a4f56833
Add 'X-Forwarded-URL' to request header (#176)
* 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
2024-03-15 16:53:10 -05:00
Umputun
616c1df314 don't add dbl headers for X-Forwarded-Proto and X-Forwarded-Proto #172 2024-02-05 23:29:35 -06:00
rashpile
631244671a send x-forwarded headers for ssl static mode as well 2024-02-01 14:42:18 -06:00
rashpile
f573cd9e86 add the X-Forwarded-Proto and X-Forwarded-Port headers for SSLAuto mode 2024-02-01 14:42:18 -06:00
rashpile
7ce7e18931 docker api 1.22 is deprecated -> minimal supported version is 1.24 2024-02-01 14:41:39 -06:00
Sergey Ninua
fe24cf99ef
Implement Host header bypassing (#155)
* Initial implementation of keep-host argument

* Add keep-host parsing to the consulcatalog provider

* Update docs

* update from the current master

---------
by @ffix
2024-01-25 03:28:54 -06:00
Eli
7d4394f1c8
Skip SSL check for the destination host (#170)
by @themagic314 

* skip ssl check on dest host
* nolint directive
* readme explanation
2024-01-07 12:19:50 -06:00
Umputun
fa23778d42 make LBSelector interface and implement all the current methods plus roundrobin 2023-11-27 12:08:28 -06:00
Umputun
8bde167226 change logger to lgr for only from msg 2023-11-26 18:49:02 -06:00
Umputun
5c07e82ac4 also add what url rejected for 2023-11-26 18:40:04 -06:00
Umputun
197c8d9db3 logging rejected IPs 2023-11-26 18:30:14 -06:00
Umputun
bddb144f60 fix order of middlewares to handle limiting by IP after match handler sets ctx 2023-11-26 17:10:16 -06:00
Umputun
672d4c2af8 add info about limited ip to logs 2023-11-26 16:52:16 -06:00
Umputun
a896f08eec add middleware to optionally allow requests from giving ips/ranges
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
2023-11-26 16:17:04 -06:00
Umputun
f37072e649 lint: minor warns in tests 2023-09-20 11:16:24 -05:00
Nikita Shoshin
2b92c11cc9 fix redirects
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.
2023-05-13 22:48:22 -05:00
Umputun
197246a05a drop legacy rand.Seed 2023-02-27 14:51:25 -06:00
Umputun
34d9f4d1d5 lint: minor warn on deferred close 2023-02-27 00:00:04 -06:00
Umputun
ffd6b08257 increase timeout a little for a flaky test 2023-02-26 16:21:16 -06:00
Umputun
ca65980093 fix redirects for docker provider 2023-02-25 22:30:54 -06:00
Umputun
22063f08cd fix docker's labels max, make it include .9 for real 2023-02-25 12:57:16 -06:00
Umputun
0ce326dbaa update deps, switch to go 1.19 2022-09-06 22:24:41 -05:00
ravilushqa
546c2609b0 defer recover 2022-08-21 03:48:44 -05:00
Vadim YR
b9e994be0c type in return error 2022-06-23 22:57:35 -05:00
Umputun
6695079c57 make sure two consecutive Server calls return the same list of servers 2022-02-23 18:07:38 -06:00
Umputun
b4225a4a4d fix error message 2022-02-15 03:00:34 -06:00
Negasus
4126fa7993 update error message 2022-02-15 02:59:44 -06:00
Negasus
22bea287e4 return error on wrong ssl.type value 2022-02-15 02:59:44 -06:00
Umputun
e2a40bc7a6 update rest library for proper 404 content type 2022-01-06 01:07:50 -06:00
Umputun
a963516783 switch from legacy FS functions to new constructor 2022-01-06 00:16:18 -06:00
Umputun
64f57df860 add support of custom 404 page for assets server 2022-01-06 00:16:18 -06:00
Alexey Nesterov
2e8733b152 Correctly handle URL escaped paths
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.
2021-12-06 11:00:07 -06:00
Umputun
075f66825a update linter and address all lint warns 2021-11-09 12:47:41 -06:00
Umputun
8c59be3612 implement simple on/off basic-auth for all resources
lint: err shadowing

extract htpasswd file load and add tests
2021-11-09 12:47:41 -06:00
Alexey Nesterov
184d5ba87c Support regex in host / server
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.
2021-11-04 12:00:17 -05:00
Umputun
76fa56777f add ability to drop incoming headers #108
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.
2021-09-11 14:38:56 -05:00
Umputun
c7a2308267 add OverrideHeadersIn and OverrideHeadersOut support
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.
2021-09-07 01:53:54 -05:00
Umputun
506ded3ad4 add a warning on missing configuration file for file provider 2021-08-28 12:25:07 -05:00
Umputun
d364904dd8 fix flaky tests 2021-08-12 22:31:15 -05:00
Umputun
803a076b79 fix incorrect detection of header's dbl quotes 2021-07-09 15:20:45 -05:00