| 129 | } |
| 130 | |
| 131 | func (p *HTTPProxy) doProxy(req *http.Request) bool { |
| 132 | if req.Host == "" { |
| 133 | p.Error("got request with empty host: %v", req) |
| 134 | return false |
| 135 | } |
| 136 | |
| 137 | hostname := strings.Split(req.Host, ":")[0] |
| 138 | for _, local := range []string{"localhost", "127.0.0.1"} { |
| 139 | if hostname == local { |
| 140 | p.Error("got request with localed host: %s", req.Host) |
| 141 | return false |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | return true |
| 146 | } |
| 147 | |
| 148 | func (p *HTTPProxy) shouldProxy(req *http.Request) bool { |
| 149 | hostname := strings.Split(req.Host, ":")[0] |