Allow CORS to GitHub raw

Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis
2017-11-28 20:26:42 +00:00
parent d20cdf561c
commit 78a4580ead
2 changed files with 30 additions and 1 deletions

View File

@ -143,7 +143,12 @@ func main() {
}
fs := http.FileServer(http.Dir("./assets/"))
r.PathPrefix("/ui/").Handler(http.StripPrefix("/ui", fs)).Methods("GET")
// This URL allows access from the UI to the OpenFaaS store
allowedCORSHost := "raw.githubusercontent.com"
fsCORS := internalHandlers.DecorateWithCORS(fs, allowedCORSHost)
r.PathPrefix("/ui/").Handler(http.StripPrefix("/ui", fsCORS)).Methods("GET")
r.HandleFunc("/", faasHandlers.RoutelessProxy).Methods("POST")