-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the best way to handle subdomains? #55
Comments
Did you check the reply to your post on Google Groups? https://groups.google.com/d/topic/golang-nuts/a7-6d1-d11o |
yes, I have checked it but it doesn't work for me |
Err, this seems to be working for me? package main
import (
"net/http"
"github.com/zenazn/goji"
"github.com/zenazn/goji/web"
)
func main() {
mux1 := web.New()
mux1.Get("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("domain one mux\n"))
})
http.Handle("domainone.com/", mux1)
mux2 := web.New()
mux2.Get("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("domain two mux\n"))
})
http.Handle("domaintwo.com/", mux2)
goji.Get("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("main mux\n"))
})
goji.Serve()
} $ curl -H "Host: domainone.com" localhost:8000
domain one mux
$ curl -H "Host: domaintwo.com" localhost:8000
domain two mux
$ curl localhost:8000
main mux |
Ok, it works. Thank you guys. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
goji.Get("subdomain.domain.xyz", root)
any idea how to handle this?
The text was updated successfully, but these errors were encountered: