mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-10-12 05:32:36 +00:00
New: Proxy all the requests to the graphql server
This commit is contained in:
@@ -21,7 +21,8 @@ func StartHTTPProxy() {
|
||||
AllowOrigins: "*",
|
||||
}))
|
||||
|
||||
server.Post("/v1/graphql", processGraphQLRequest)
|
||||
server.Post("/*", processGraphQLRequest)
|
||||
server.Get("/*", proxyTheRequest)
|
||||
|
||||
server.Get("/healthz", healthCheck)
|
||||
err := server.Listen(fmt.Sprintf(":%d", cfg.Server.PortGraphQL))
|
||||
@@ -70,11 +71,16 @@ func processGraphQLRequest(c *fiber.Ctx) error {
|
||||
}
|
||||
}
|
||||
|
||||
opType, opName, cacheFromQuery, cache_time, shouldBlock := parseGraphQLQuery(c)
|
||||
opType, opName, cacheFromQuery, cache_time, shouldBlock, should_ignore := parseGraphQLQuery(c)
|
||||
if shouldBlock {
|
||||
return nil
|
||||
}
|
||||
|
||||
if should_ignore {
|
||||
cfg.Logger.Debug("Request passed as-is - not a GraphQL")
|
||||
return proxyTheRequest(c)
|
||||
}
|
||||
|
||||
if cache_time > 0 {
|
||||
cfg.Logger.Debug("Cache time set via query", map[string]interface{}{"cache_time": cache_time})
|
||||
cache_time = cfg.Cache.CacheTTL
|
||||
|
||||
Reference in New Issue
Block a user