comparison controllers/routes.go @ 346:ad0e47c1fedf

Use httputil.ReverseProxy for WFS proxying.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 06 Aug 2018 16:46:42 +0200
parents bd292a554b6e
children 1ea90a22bd15
comparison
equal deleted inserted replaced
345:b97b3172c61a 346:ad0e47c1fedf
1 package controllers 1 package controllers
2 2
3 import ( 3 import (
4 "net/http" 4 "net/http"
5 "net/http/httputil"
5 6
6 "gemma.intevation.de/gemma/auth" 7 "gemma.intevation.de/gemma/auth"
7 8
8 "github.com/gorilla/mux" 9 "github.com/gorilla/mux"
9 ) 10 )
49 api.Handle("/users/passwordreset/{hash}", &JSONHandler{ 50 api.Handle("/users/passwordreset/{hash}", &JSONHandler{
50 Handle: passwordReset, 51 Handle: passwordReset,
51 }).Methods(http.MethodGet) 52 }).Methods(http.MethodGet)
52 53
53 // Proxy for external WFSs. 54 // Proxy for external WFSs.
54 api.HandleFunc("/externalwfs/{wfs}", externalWFSProxy). 55 externalWFSProxy := &httputil.ReverseProxy{
56 Director: externalWFSDirector,
57 Transport: RoundTripFunc(externalWFSTransport),
58 ModifyResponse: externalWFSModifyResponse,
59 }
60
61 api.Handle("/externalwfs/{wfs}", externalWFSProxy).
55 Methods( 62 Methods(
56 http.MethodGet, http.MethodPost, 63 http.MethodGet, http.MethodPost,
57 http.MethodPut, http.MethodDelete) 64 http.MethodPut, http.MethodDelete)
58 65
59 // Token handling: Login/Logout. 66 // Token handling: Login/Logout.