chore: update default configuration
This commit is contained in:
@@ -243,6 +243,7 @@ func initConfig(configFile string) {
|
|||||||
DisableRouteHealthCheckError: false,
|
DisableRouteHealthCheckError: false,
|
||||||
DisableDisplayRouteOnStart: false,
|
DisableDisplayRouteOnStart: false,
|
||||||
RateLimiter: 0,
|
RateLimiter: 0,
|
||||||
|
InterceptErrors: []int{405, 500},
|
||||||
Cors: Cors{
|
Cors: Cors{
|
||||||
Origins: []string{"http://localhost:8080", "https://example.com"},
|
Origins: []string{"http://localhost:8080", "https://example.com"},
|
||||||
Headers: map[string]string{
|
Headers: map[string]string{
|
||||||
@@ -253,8 +254,7 @@ func initConfig(configFile string) {
|
|||||||
},
|
},
|
||||||
Routes: []Route{
|
Routes: []Route{
|
||||||
{
|
{
|
||||||
Name: "HealthCheck",
|
Name: "Public",
|
||||||
Host: "localhost",
|
|
||||||
Path: "/public",
|
Path: "/public",
|
||||||
Destination: "http://localhost:80",
|
Destination: "http://localhost:80",
|
||||||
Rewrite: "/healthz",
|
Rewrite: "/healthz",
|
||||||
@@ -282,19 +282,27 @@ func initConfig(configFile string) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "Hostname example",
|
||||||
|
Host: "example.com",
|
||||||
|
Path: "/",
|
||||||
|
Destination: "https://example.com",
|
||||||
|
Rewrite: "/",
|
||||||
|
HealthCheck: "",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Middlewares: []Middleware{
|
Middlewares: []Middleware{
|
||||||
{
|
{
|
||||||
Name: "basic-auth",
|
Name: "basic-auth",
|
||||||
Type: "basic",
|
Type: basicAuth,
|
||||||
Rule: BasicRule{
|
Rule: BasicRule{
|
||||||
Username: "goma",
|
Username: "goma",
|
||||||
Password: "goma",
|
Password: "goma",
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
Name: "jwt",
|
Name: "jwt",
|
||||||
Type: "jwt",
|
Type: jwtAuth,
|
||||||
Rule: JWTRuler{
|
Rule: JWTRuler{
|
||||||
URL: "https://www.googleapis.com/auth/userinfo.email",
|
URL: "https://www.googleapis.com/auth/userinfo.email",
|
||||||
RequiredHeaders: []string{
|
RequiredHeaders: []string{
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ func (proxyRoute ProxyRoute) ProxyHandler() http.HandlerFunc {
|
|||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
realIP := getRealIP(r)
|
realIP := getRealIP(r)
|
||||||
logger.Info("%s %s %s %s", r.Method, realIP, r.URL, r.UserAgent())
|
logger.Info("%s %s %s %s", r.Method, realIP, r.URL, r.UserAgent())
|
||||||
|
//Set Server name
|
||||||
|
w.Header().Set("Server", serverName)
|
||||||
// Set CORS headers from the cors config
|
// Set CORS headers from the cors config
|
||||||
//Update Cors Headers
|
//Update Cors Headers
|
||||||
for k, v := range proxyRoute.cors.Headers {
|
for k, v := range proxyRoute.cors.Headers {
|
||||||
|
|||||||
@@ -5,3 +5,4 @@ const accessControlAllowOrigin = "Access-Control-Allow-Origin"
|
|||||||
const basicAuth = "basicAuth"
|
const basicAuth = "basicAuth"
|
||||||
const jwtAuth = "jwtAuth"
|
const jwtAuth = "jwtAuth"
|
||||||
const OAuth = "OAuth"
|
const OAuth = "OAuth"
|
||||||
|
const serverName = "Goma"
|
||||||
|
|||||||
Reference in New Issue
Block a user