Commit Graph

99 Commits

Author SHA1 Message Date
Umputun
ffd6b08257 increase timeout a little for a flaky test 2023-02-26 16:21:16 -06:00
Umputun
6695079c57 make sure two consecutive Server calls return the same list of servers 2022-02-23 18:07:38 -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
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
d364904dd8 fix flaky tests 2021-08-12 22:31:15 -05:00
Umputun
56e040b80b allow longer time to start proxy in limiter test 2021-07-08 16:32:24 -05:00
Umputun
71039681e2
Merge pull request #97
* revendor with latest rest lib

* simplify with passThroughHandler

* add deps for throttling
2021-07-03 01:23:50 -05:00
Umputun
13c70eb8e8 add health integration test 2021-06-12 13:26:42 -05:00
Umputun
e44ca79f23 add support of spa to common assets 2021-06-07 19:16:18 -05:00
Umputun
f0049ef7ac add support of spa-like assets handling 2021-06-07 19:16:18 -05:00
Umputun
687e78e87b drop attempt to parse form in limiter, conflicts with form body 2021-06-07 16:20:23 -05:00
Umputun
15616dfa57 longer sleep for flaky test 2021-06-06 18:20:38 -05:00
Umputun
aea74d717f
Redirect (#87)
* add @code redirect prefix

* add proxy handling for redirects #86

* add info about redirects
2021-06-06 18:13:59 -05:00
Umputun
680d988d42 change url value in final proxy to const usage 2021-06-01 04:00:38 -05:00
Umputun
56cd1205a1 clean usage of plugin context in proxy 2021-06-01 03:59:23 -05:00
Umputun
b3d222a60a quick and dirty fix for assets rules regression 2021-06-01 03:50:20 -05:00
Umputun
0b3e1d9062 warn logging on destination parser 2021-06-01 03:34:50 -05:00
Umputun
3efcd15747 add warns on static path issues 2021-06-01 03:25:35 -05:00
Umputun
7139c57766
RPC plugins support (#85)
* wip

* resolve merge artifacts

* full coverage for conductor

* wire plugin conductor to main and proxy

* wip, with separate match handler

* split matching logic with another handler, add initial docs

* move parts of proxy to handlers, add tests

* add headers in to be sent to proxied url

* merged from master

* add example with docker compose

* supress excesive debug reporting 0-9 disabled in docker

* add plugin tests

* randomize test port

* lint: minor warns

* lint: err shadow
2021-06-01 02:56:39 -05:00
Umputun
282b4b268c add lb selector 2021-05-28 16:11:16 -05:00
Umputun
971e77b5d3 eliminate metrics middleware hit if mgmt disabled 2021-05-22 10:44:21 -05:00
Umputun
095f4d7102
Multi match (#74)
* discovery support for multiple matches

* switch proxy matcher usage, add random selection

* fix multi-match logic

* pass match picker func

* simplify rand picker

* update health params and docs

* fix early termination on discovery multi-match

* add grouping of sorted matches in sorted result

* add mention of live check to readme
2021-05-16 18:34:51 -05:00
nikolay.bystritskiy
bfe5f3fdbf fix ticker, variable names and unnecessary if in Service.Match 2021-05-16 14:17:50 -05:00
nikolay.bystritskiy
49515e307c update health state not sorting or reordering mappers 2021-05-16 14:17:50 -05:00
nikolay.bystritskiy
973d6c9a14 add automatic health-checker 2021-05-16 14:17:50 -05:00
Umputun
f6f26a4807 add log for enabled options 2021-05-14 22:14:49 -05:00
Umputun
aee7e8a57e revert to stable go-pgz/rest, switch size limiter to local implementation #71 2021-05-14 16:17:52 -05:00
Umputun
137cf692c4 switch to master go-pkgz/rest #71 2021-05-14 13:47:44 -05:00
Umputun
a93bd40f8a treat 0 max request size limit as unlimited 2021-05-12 21:54:41 -05:00
Umputun
25ee73d8d6 set X-Forwarded-Host to orid host, drop X-Origin-Host #67 2021-05-10 03:50:00 -05:00
Umputun
a73a16c12b wait till fqdn avail for ssl auto #63 2021-05-05 01:41:23 -05:00
Umputun
211fe15b8f add autocert details log 2021-05-04 12:51:07 -05:00
Umputun
3eba72cbff extend health chek to make sure all pings called 2021-05-02 12:52:29 -05:00
Umputun
5743109210
Nice error (#61)
* add support of html error reporting with custom templates

* typo

* formatting

* better template load error msg
2021-04-30 04:03:36 -05:00
Umputun
06e78b81d4 extend no match WARN 2021-04-28 14:47:53 -05:00
Umputun
1ff45cc2ca add integration test over https 2021-04-27 02:50:45 -05:00
Umputun
604391e55e extend tests for tricky cases 2021-04-27 01:57:04 -05:00
Umputun
66eb3ffe4a support d units in cache duration 2021-04-27 01:40:46 -05:00
Umputun
a4cffbe922
Mime cache (#59)
* support different caching duration for different mime types #58

* extract main code to run func

* lint: err shadowing
2021-04-26 18:51:48 -05:00
Umputun
9a7a92fc41 make deadlock test on health handler more realistic 2021-04-24 04:03:29 -05:00
Umputun
c590c3246d
Assets cache (#54)
* add caching control for assets
* regen site
2021-04-23 02:02:36 -05:00
Nikita Vasiliev
ef8298bb9c Test to catch a deadlock in healthHandler() 2021-04-21 17:30:34 -05:00
Nikita Vasiliev
38af32f37c Fix a deadlock 2021-04-21 17:30:34 -05:00
Umputun
f16d92b774 lint: minor warns 2021-04-20 19:22:46 -05:00
Umputun
aef3040b60 fix tests regression 2021-04-20 19:22:46 -05:00