You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It should return the page from Google. The problem is that I keep getting a 404 not found. Any idea please?
$ curl "http://localhost:8000/"
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 404 (Not Found)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/errors/logo_sm_2.png) no-repeat}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/errors/logo_sm_2_hr.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:55px;width:150px}
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>404.</b> <ins>That’s an error.</ins>
<p>The requested URL <code>/</code> was not found on this server. <ins>That’s all we know.</ins>
Here is my code.
package main
import (
"log""net/http""os""time""github.com/mailgun/vulcan""github.com/mailgun/vulcan/endpoint""github.com/mailgun/vulcan/loadbalance""github.com/mailgun/vulcan/loadbalance/roundrobin""github.com/mailgun/vulcan/location/httploc""github.com/mailgun/vulcan/route"
)
varPORTstring=os.Getenv("PORT")
varsmtpServers= []string{"https://www.google.com"}
funcNewBalancer(servers []string) loadbalance.LoadBalancer {
// Create a round robin load balancer with some endpointsrr, err:=roundrobin.NewRoundRobin()
iferr!=nil {
log.Fatalf("Error: %s", err)
}
for_, s:=rangeservers {
rr.AddEndpoint(endpoint.MustParseUrl(s))
}
returnrr
}
funcmain() {
rr:=NewBalancer(smtpServers)
// Create a http location with the load balancer we've just addedloc, err:=httploc.NewLocation("loc1", rr)
iferr!=nil {
log.Fatalf("Error: %s", err)
}
// Create a proxy server that routes all requests to "loc1"proxy, err:=vulcan.NewProxy(&route.ConstRouter{Location: loc})
iferr!=nil {
log.Fatalf("Error: %s", err)
}
// Proxy acts as http handler:server:=&http.Server{
Addr: ":"+PORT,
Handler: proxy,
ReadTimeout: 10*time.Second,
WriteTimeout: 10*time.Second,
MaxHeaderBytes: 1<<20,
}
log.Println("Listening on port "+PORT)
server.ListenAndServe()
iferr!=nil {
log.Panic(err)
}
}
The text was updated successfully, but these errors were encountered:
Quantisan
changed the title
Reverse Proxy example from quickstart keeps getting 404 not found
Load Balancer example from quickstart keeps getting 404 not found
Aug 3, 2014
I'm trying the load balancer example to reach https://www.google.com (i.e. single upstream node) from localhost. Such that when I do,
It should return the page from Google. The problem is that I keep getting a 404 not found. Any idea please?
Here is my code.
The text was updated successfully, but these errors were encountered: