comparison pkg/controllers/proxy.go @ 1127:71ba4a66ec95

Return 404 if a proxied service is not found.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 07 Nov 2018 16:08:25 +0100
parents aac42dacb503
children 813342f2e927
comparison
equal deleted inserted replaced
1125:dbc663b74724 1127:71ba4a66ec95
31 31
32 "github.com/gorilla/mux" 32 "github.com/gorilla/mux"
33 "golang.org/x/net/html/charset" 33 "golang.org/x/net/html/charset"
34 34
35 "gemma.intevation.de/gemma/pkg/config" 35 "gemma.intevation.de/gemma/pkg/config"
36 "gemma.intevation.de/gemma/pkg/middleware"
36 ) 37 )
37 38
38 // proxyBlackList is a set of URLs that should not be rewritten by the proxy. 39 // proxyBlackList is a set of URLs that should not be rewritten by the proxy.
39 var proxyBlackList = map[string]struct{}{ 40 var proxyBlackList = map[string]struct{}{
40 "http://www.w3.org/2001/XMLSchema-instance": struct{}{}, 41 "http://www.w3.org/2001/XMLSchema-instance": struct{}{},
64 65
65 var s string 66 var s string
66 67
67 if entry, found := vars["entry"]; found { 68 if entry, found := vars["entry"]; found {
68 if s, found = lookup(entry); !found { 69 if s, found = lookup(entry); !found {
69 abort("warn: cannot find entry '%s'\n", entry) 70 log.Printf("warn: cannot find eintry '%s'\n", entry)
71 panic(middleware.ErrNotFound)
70 } 72 }
71 } else { 73 } else {
72 expectedMAC, err := base64.URLEncoding.DecodeString(vars["hash"]) 74 expectedMAC, err := base64.URLEncoding.DecodeString(vars["hash"])
73 if err != nil { 75 if err != nil {
74 abort("Cannot base64 decode hash: %v\n", err) 76 abort("Cannot base64 decode hash: %v\n", err)