Mercurial > gemma
comparison pkg/controllers/routes.go @ 421:c37457f12b8e
Differ between internal and external proxies.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 16 Aug 2018 15:17:21 +0200 |
parents | 6627c48363a0 |
children | 4a03d000c854 |
comparison
equal
deleted
inserted
replaced
420:be38eec5cc25 | 421:c37457f12b8e |
---|---|
52 Handle: passwordReset, | 52 Handle: passwordReset, |
53 }).Methods(http.MethodGet) | 53 }).Methods(http.MethodGet) |
54 | 54 |
55 // Proxy for external WFSs. | 55 // Proxy for external WFSs. |
56 proxy := &httputil.ReverseProxy{ | 56 proxy := &httputil.ReverseProxy{ |
57 Director: proxyDirector, | 57 Director: proxyDirector(findProxy("external")), |
58 ModifyResponse: proxyModifyResponse("/api/proxy/"), | 58 ModifyResponse: proxyModifyResponse("/api/external/"), |
59 } | 59 } |
60 | 60 |
61 api.Handle("/proxy/{hash}/{url}", proxy). | 61 api.Handle("/external/{hash}/{url}", proxy). |
62 Methods( | 62 Methods( |
63 http.MethodGet, http.MethodPost, | 63 http.MethodGet, http.MethodPost, |
64 http.MethodPut, http.MethodDelete) | 64 http.MethodPut, http.MethodDelete) |
65 | 65 |
66 api.Handle("/proxy/{entry}", proxy). | 66 api.Handle("/external/{entry}", proxy). |
67 Methods( | 67 Methods( |
68 http.MethodGet, http.MethodPost, | 68 http.MethodGet, http.MethodPost, |
69 http.MethodPut, http.MethodDelete) | 69 http.MethodPut, http.MethodDelete) |
70 | 70 |
71 // Proxy for external WFSs. | 71 // Proxy for external WFSs. |
72 internal := &httputil.ReverseProxy{ | 72 internal := &httputil.ReverseProxy{ |
73 Director: proxyDirector, | 73 Director: proxyDirector(findProxy("internal")), |
74 ModifyResponse: proxyModifyResponse("/api/internal"), | 74 ModifyResponse: proxyModifyResponse("/api/internal/"), |
75 } | 75 } |
76 | 76 |
77 internalAuth := all( | 77 internalAuth := all( |
78 middleware.ModifyQuery(internal, middleware.InjectUser)) | 78 middleware.ModifyQuery(internal, middleware.InjectUser)) |
79 | 79 |