2024-11-15 07:56:37 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright 2024 Jonas Kaninda
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package pkg
|
|
|
|
|
|
|
|
|
|
// Route defines gateway route
|
|
|
|
|
type Route struct {
|
|
|
|
|
// Path defines route path
|
|
|
|
|
Path string `yaml:"path"`
|
|
|
|
|
// Name defines route name
|
|
|
|
|
Name string `yaml:"name"`
|
2024-11-17 05:28:27 +01:00
|
|
|
// Host Domain/host based request routing
|
|
|
|
|
// Host string `yaml:"host"`
|
|
|
|
|
// Hosts Domains/hosts based request routing
|
2024-11-15 07:56:37 +01:00
|
|
|
Hosts []string `yaml:"hosts"`
|
|
|
|
|
// Rewrite rewrites route path to desired path
|
|
|
|
|
//
|
|
|
|
|
// E.g. /cart to / => It will rewrite /cart path to /
|
|
|
|
|
Rewrite string `yaml:"rewrite"`
|
|
|
|
|
//
|
|
|
|
|
// Methods allowed method
|
|
|
|
|
Methods []string `yaml:"methods"`
|
|
|
|
|
// Destination Defines backend URL
|
|
|
|
|
Destination string `yaml:"destination"`
|
|
|
|
|
Backends []string `yaml:"backends"`
|
|
|
|
|
InsecureSkipVerify bool `yaml:"insecureSkipVerify"`
|
|
|
|
|
// HealthCheck Defines the backend is health
|
|
|
|
|
HealthCheck RouteHealthCheck `yaml:"healthCheck"`
|
|
|
|
|
// Cors contains the route cors headers
|
|
|
|
|
Cors Cors `yaml:"cors"`
|
|
|
|
|
RateLimit int `yaml:"rateLimit"`
|
|
|
|
|
// DisableHostFording Disable X-forwarded header.
|
|
|
|
|
//
|
|
|
|
|
// [X-Forwarded-Host, X-Forwarded-For, Host, Scheme ]
|
|
|
|
|
//
|
|
|
|
|
// It will not match the backend route
|
|
|
|
|
DisableHostFording bool `yaml:"disableHostFording"`
|
|
|
|
|
// InterceptErrors holds the status codes to intercept the error from backend
|
|
|
|
|
InterceptErrors []int `yaml:"interceptErrors"`
|
|
|
|
|
// BlockCommonExploits enable, disable block common exploits
|
|
|
|
|
BlockCommonExploits bool `yaml:"blockCommonExploits"`
|
2024-11-15 14:24:35 +01:00
|
|
|
// Middlewares Defines route middlewares from Middleware names
|
2024-11-15 07:56:37 +01:00
|
|
|
Middlewares []string `yaml:"middlewares"`
|
|
|
|
|
}
|
2024-11-18 08:50:49 +01:00
|
|
|
|
|
|
|
|
type ExtraRoute struct {
|
|
|
|
|
// Routes holds proxy routes
|
|
|
|
|
Routes []Route `yaml:"routes"`
|
|
|
|
|
}
|
2024-11-21 16:52:08 +01:00
|
|
|
type ExtraMiddleware struct {
|
|
|
|
|
// Routes holds proxy routes
|
|
|
|
|
Middlewares []Middleware `yaml:"middlewares"`
|
|
|
|
|
}
|