diff --git a/README.md b/README.md index 123f873..bce469c 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ Create a config file in this format Example of a configuration file ```yaml -# Goma Gateway configurations +## Goma Gateway configurations gateway: # Proxy write timeout writeTimeout: 15 @@ -132,7 +132,6 @@ gateway: ## SSL Private Key file sslKeyFile: ''#key.pem # Proxy rate limit, it's In-Memory IP based - # Distributed Rate Limiting for Token based across multiple instances is not yet integrated rateLimiter: 0 accessLog: "/dev/Stdout" errorLog: "/dev/stderr" diff --git a/docs/quickstart.md b/docs/quickstart.md index fe9ec69..32993d6 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -68,7 +68,6 @@ gateway: ## SSL Private Key file sslKeyFile: ''#key.pem # Proxy rate limit, it's In-Memory IP based - # Distributed Rate Limiting for Token based across multiple instances is not yet integrated rateLimiter: 0 accessLog: "/dev/Stdout" errorLog: "/dev/stderr" diff --git a/docs/route.md b/docs/route.md index d5f860d..a8bd2cb 100644 --- a/docs/route.md +++ b/docs/route.md @@ -13,48 +13,7 @@ The Route allows you to match on HTTP traffic and direct it to the backend. ### Create a route ```yaml - ##### Define routes - routes: - # Example of a route | 1 - - name: Public - # host Domain/host based request routing - host: "" # Host is optional - path: /public - ## Rewrite a request path - # e.g rewrite: /store to / - rewrite: / - destination: https://example.com - #DisableHeaderXForward Disable X-forwarded header. - # [X-Forwarded-Host, X-Forwarded-For, Host, Scheme ] - # It will not match the backend route, by default, it's disabled - disableHeaderXForward: false - # Internal health check - healthCheck: '' #/internal/health/ready - # Route Cors, global cors will be overridden by route - cors: - # Route Origins Cors, global cors will be overridden by route - origins: - - https://dev.example.com - - http://localhost:3000 - - https://example.com - # Route Cors headers, route will override global cors - headers: - Access-Control-Allow-Methods: 'GET' - Access-Control-Allow-Headers: 'Origin, Authorization, Accept, Content-Type, Access-Control-Allow-Headers, X-Client-Id, X-Session-Id' - Access-Control-Allow-Credentials: 'true' - Access-Control-Max-Age: 1728000 - ##### Define route middlewares from middlewares names - ## The name must be unique - ## List of middleware name - middlewares: - - api-forbidden-paths - - basic-auth -``` - -### Full example of route - -```yaml -# Goma Gateway configurations + # Goma Gateway configurations gateway: # Proxy write timeout writeTimeout: 15 @@ -67,7 +26,6 @@ gateway: ## SSL Private Key file sslKeyFile: ''#key.pem # Proxy rate limit, it's In-Memory IP based - # Distributed Rate Limiting for Token based across multiple instances is not yet integrated rateLimiter: 0 accessLog: "/dev/Stdout" errorLog: "/dev/stderr" @@ -81,8 +39,8 @@ gateway: disableKeepAlive: false # interceptErrors intercepts backend errors based on defined the status codes interceptErrors: - - 405 - - 500 + - 405 + - 500 # - 400 # Proxy Global HTTP Cors cors: @@ -99,7 +57,7 @@ gateway: routes: # Example of a route | 1 - name: Public - # host Domain/host based request routing + # host Domain/host based request routing host: "" # Host is optional path: /public ## Rewrite a request path @@ -177,16 +135,16 @@ middlewares: # In case you want to get headers from the authentication service and inject them into the next request headers. # Key is authentication request response header Key. Value is the next Request header Key. headers: - userId: Auth-UserId - userCountryId: Auth-UserCountryId + userId: Auth-UserId + userCountryId: Auth-UserCountryId # In case you want to get headers from the Authentication service and inject them to the next request params. #Key is authentication request response header Key. Value is the next Request parameter Key. params: userCountryId: countryId - # The server will return 403 +# The server will return 403 - name: api-forbidden-paths type: access - ## prevents access paths + ## prevents access paths paths: - /swagger-ui/* - /v2/swagger-ui/* diff --git a/examples/configMap.yaml b/examples/configMap.yaml index d628a93..7d2efe2 100644 --- a/examples/configMap.yaml +++ b/examples/configMap.yaml @@ -4,20 +4,24 @@ metadata: name: goma-config data: goma.yml: | + # Goma Gateway configurations gateway: - ########## Global settings - listenAddr: 0.0.0.0:80 # Proxy write timeout writeTimeout: 15 # Proxy read timeout readTimeout: 15 # Proxy idle timeout idleTimeout: 60 + ## SSL Certificate file + sslCertFile: '' #cert.pem + ## SSL Private Key file + sslKeyFile: ''#key.pem # Proxy rate limit, it's In-Memory IP based - # Distributed Rate Limiting for Token based across multiple instances is not yet integrated rateLimiter: 0 accessLog: "/dev/Stdout" errorLog: "/dev/stderr" + ## Enable, disable routes health check + disableHealthCheckStatus: false ## Returns backend route healthcheck errors disableRouteHealthCheckError: false # Disable display routes on start @@ -59,23 +63,23 @@ data: healthCheck: '' #/internal/health/ready # Route Cors, global cors will be overridden by route cors: - # Route Origins Cors, global cors will be overridden by route + # Route Origins Cors, route will override global cors origins origins: - https://dev.example.com - http://localhost:3000 - https://example.com - # Route Cors headers, route will override global cors + # Route Cors headers, route will override global cors headers headers: Access-Control-Allow-Methods: 'GET' Access-Control-Allow-Headers: 'Origin, Authorization, Accept, Content-Type, Access-Control-Allow-Headers, X-Client-Id, X-Session-Id' Access-Control-Allow-Credentials: 'true' Access-Control-Max-Age: 1728000 - ##### Define route middlewares from middlewares names + ##### Apply middlewares to the route ## The name must be unique ## List of middleware name middlewares: - api-forbidden-paths - # Example of a route | 3 + # Example of a route | 2 - name: Basic auth path: /protected rewrite: / @@ -116,20 +120,16 @@ data: # Required headers, if not present in the request, the proxy will return 403 requiredHeaders: - Authorization - #Sets the request variable to the given value after the authorization request completes. - # - # Add header to the next request from AuthRequest header, depending on your requirements - # Key is AuthRequest's response header Key, and value is Request's header Key - # In case you want to get headers from the Authentication service and inject them into the next request's headers - #Sets the request variable to the given value after the authorization request completes. - # - # Add header to the next request from AuthRequest header, depending on your requirements - # Key is AuthRequest's response header Key, and value is Request's header Key + # You can also get headers from the authentication request result and inject them into the next request header or params. + # In case you want to get headers from the authentication service and inject them into the next request headers. + # Set the request variable to the given value after the authorization request completes. # In case you want to get headers from the authentication service and inject them into the next request headers. + # Key is authentication request response header Key. Value is the next Request header Key. headers: - userId: X-Auth-UserId - userCountryId: X-Auth-UserCountryId - # In case you want to get headers from the Authentication service and inject them to the next request params. + userId: Auth-UserId + userCountryId: Auth-UserCountryId + # In case you want to get headers from the Authentication service and inject them to the next request params. + #Key is authentication request response header Key. Value is the next Request parameter Key. params: userCountryId: countryId # The server will return 403 diff --git a/goma.yml b/goma.yml index 9d862bc..04f8f9b 100644 --- a/goma.yml +++ b/goma.yml @@ -11,7 +11,6 @@ gateway: ## SSL Private Key file sslKeyFile: ''#key.pem # Proxy rate limit, it's In-Memory IP based - # Distributed Rate Limiting for Token based across multiple instances is not yet integrated rateLimiter: 0 accessLog: "/dev/Stdout" errorLog: "/dev/stderr"