I have a server written in Go. I want to write for it a reverse proxy server. The server is compiled into one binary file. When I try to access it through a proxy server, it returns only the HTML page without bindings to CSS and JS scripts. How can I organize the transfer of static files?
package main
import (
"log"
"net/http"
"net/http/httputil"
"net/url"
"time"
)
func main() {
mux := http.NewServeMux()
u1, _ := url.Parse("http://localhost:8080/")
proxy := httputil.NewSingleHostReverseProxy(u1)
mux.Handle("/app1", proxy)
serv := &http.Server{
Addr: ":9090",
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
Handler: mux,
}
err := serv.ListenAndServe()
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
}