Commit Graph

29 Commits

Author SHA1 Message Date
Thomas P. 8bd2bdfd9c fix(proxy): handle lowercase Location header (#20)
When the upstream server returns a redirect HTTP response code but its "Location" header is in lowercase, the proxy will retry the request 5 times and eventually fail with an "missing Location header for http redirect" error.

Since the HTTP spec says header names are case-insensitive, we should handle this case properly. Adjust fasthttp options accordingly

Ref: https://github.com/valyala/fasthttp/issues/1361
2024-12-19 18:49:24 +00:00
lukaszraczylo 6b31e5c4c0 Little code cleanup. (#19) 2024-10-10 10:34:23 +01:00
lukaszraczylo cdd2a2a2c6 Enhance the retry logic for the proxied queries. 2024-08-20 12:45:22 +01:00
lukaszraczylo 9150b25227 Fixing the proxy timeout settings which were not passed to the client and and graphql server. 2024-08-20 11:38:40 +01:00
lukaszraczylo a24e6c8c4d fixup! Fix the introduced bug where RO endpoint could've been accidentally used. (#17) 2024-06-29 08:52:41 +01:00
lukaszraczylo b10a28bf52 General code optimisations. (#16)
* General code optimisations.
2024-06-28 12:31:01 +01:00
lukaszraczylo 61d7a45d00 Update cache library, use miniredis for testing, add additional benchmarks. (#14)
Update cache library,
Update logging library,
use miniredis for testing, add additional benchmarks.
2024-06-19 23:10:36 +01:00
lukaszraczylo e495cf23d9 Read only endpoint support (#10)
* This change introduces ability to set additional endpoint leading to the
instance of the graphql server connected to the read only database.
If regular query is detected and endpoint for `HOST_GRAPHQL_READONLY` value is set,
the query will be proxied to it. Mutations and non-graphql will be sent
to the `HOST_GRAPHQL` endpoint.
2024-03-12 11:16:35 +00:00
lukaszraczylo 3a18e0e935 Improve stats gathering and tests improvements. (#8) 2024-03-05 22:40:06 +00:00
lukaszraczylo 88ef1aac7f Reuse http client and add retry to the proxied requests. 2024-03-05 14:38:03 +00:00
lukaszraczylo 6d32278851 Reuse http client. 2024-03-05 14:24:49 +00:00
lukaszraczylo d3a8da1dcf Move location of the global proxy client from the per-req to main.
There's no need to re-create it every single time.
2024-02-05 14:35:33 +00:00
lukaszraczylo cd9c650226 Remove compression from proxied request. 2023-12-13 23:13:34 +00:00
lukaszraczylo d09940ebc4 Update connection settings. 2023-12-13 22:50:41 +00:00
lukaszraczylo b497ad1d1c Add generation of query uuid logs and easier debugging. 2023-10-25 14:11:44 +01:00
lukaszraczylo 3e6fa2036e Remove idle connections setup and allow the client to handle them 2023-10-24 16:56:01 +01:00
lukaszraczylo 4640eb2596 Adjust the timeout settings to prevent forever-hanging connections. 2023-10-24 15:52:40 +01:00
lukaszraczylo 3d70018179 Add configurable timeout for queries. 2023-10-24 10:40:17 +01:00
lukaszraczylo 2be4f17ea3 Disable header normalisation.
It looks like a bug in hasura which makes headers case sensitive.
2023-10-16 15:47:48 +01:00
lukaszraczylo 3cb9088b73 Revert disable headers normalising. 2023-10-16 15:31:45 +01:00
lukaszraczylo f50f98b3d6 Add printing out the request headers in debug mode. 2023-10-16 15:31:16 +01:00
lukaszraczylo bf18f36e45 If proxying of the query fails - return 500. 2023-10-13 14:48:53 +01:00
lukaszraczylo 3c0f9f49fd Add debugging option for the request / response cycle. 2023-10-13 14:23:05 +01:00
lukaszraczylo bf9ec2c877 Reuse fasthttp client 2023-10-12 21:16:57 +01:00
lukaszraczylo 815a6841ed Add ability to set up allowed paths for proxying. 2023-10-12 14:12:03 +01:00
lukaszraczylo f41b2ae46f New: Proxy all the requests to the graphql server 2023-10-11 11:26:55 +01:00
lukaszraczylo 1a3628837f Extract helper libraries from private repo of telegram-bot.app 2023-10-10 22:16:50 +01:00
lukaszraczylo 8673f1caf8 Remove println and replace it with our logging 2023-10-07 14:13:29 +01:00
lukaszraczylo 39d3afdd05 Initial commit. 2023-10-07 11:14:20 +01:00