Re: [go-nuts] http.FileServer: how to serve static files requested from different domains?

2018-01-14 Thread Ayan George
On 01/13/2018 11:26 PM, Constantine Vassilev wrote: > Here is how I implemented it: > Well -- just to be clear: I think my solution is wrong. I didn't understand how http.ServeMux worked: https://golang.org/pkg/net/http/#ServeMux Andy Balholm pointed out that http.Handle() can accept a

Re: [go-nuts] http.FileServer: how to serve static files requested from different domains?

2018-01-13 Thread Constantine Vassilev
Here is how I implemented it: func wwwAssetsHandler(w http.ResponseWriter, r *http.Request) { if r.Host == "domain.net" || r.Host == "www.domain.net" || r.Host == "domain.com" || r.Host == "www.domain.com" { var webrootStr = homePath + "/Desktop/" + "www.domain.com" fs :=

Re: [go-nuts] http.FileServer: how to serve static files requested from different domains?

2018-01-10 Thread Ayan George
On 01/09/2018 02:34 PM, Andy Balholm wrote: > Try: > > http.Handle(“domain1.com/assets/", http.StripPrefix("/", > http.FileServer(http.Dir(*webrootdomain1 > http.Handle(“domain2.com/assets/", http.StripPrefix("/", > http.FileServer(http.Dir(*webrootdomain2 > Wow! Reading is

Re: [go-nuts] http.FileServer: how to serve static files requested from different domains?

2018-01-09 Thread Andy Balholm
Try: http.Handle(“domain1.com/assets/", http.StripPrefix("/", http.FileServer(http.Dir(*webrootdomain1 http.Handle(“domain2.com/assets/", http.StripPrefix("/", http.FileServer(http.Dir(*webrootdomain2 -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] http.FileServer: how to serve static files requested from different domains?

2018-01-09 Thread Ayan George
Constantine Vassilev wrote: > > I have web server serving requests from two domains: domain1.com and > domain2.com > The assets directories are different for the two domains. > > webrootdomain1/assets > and > webrootdomain2/assets > > How to make the handler for assets to

[go-nuts] http.FileServer: how to serve static files requested from different domains?

2018-01-09 Thread Constantine Vassilev
I have web server serving requests from two domains: domain1.com and domain2.com The assets directories are different for the two domains. webrootdomain1/assets and webrootdomain2/assets How to make the handler for assets to serve different directory depending from the requests from