Closed lws-team closed 5 years ago
It looks like your site is responding with a 406
depending on the user agent:
package main
import (
"fmt"
"net/http"
)
func main() {
resp, _ := http.Get("http://libwebsockets.org/")
fmt.Printf("%#s", resp)
}
Result:
> go run main.go
&{406 Not Acceptable %!s(int=406) HTTP/1.0 %!s(int=1) %!s(int=0) map[Content-Length:[177] Content-Type:[text/html] Server:[lwsws]] %!s(*http.bodyEOFSignal=&{c00012c140 {0 0} false <nil> 1223340 12232d0}) %!s(int64=177) [] %!s(bool=true) %!s(bool=false) map[] %!s(*http.Request=&{GET c00011e000 HTTP/1.1 1 1 map[] <nil> <nil> 0 [] false libwebsockets.org map[] map[] <nil> map[] <nil> <nil> <nil> <nil>}) %!s(*tls.ConnectionState=<nil>)}
hstspreload.org
expects sites to send an HSTS header response regardless of user agent.
Thanks... I have a blacklist of useragent strings for misbehaved bots, they get sent packing with a 406. Go-http-client is in there sure enough. Sorry for the noise!
A note in case someone else comes across this issue and is having a similar problem: I found that Cloudflare's Bot Fight Mode was intercepting the requests from hstspreload.org and causing the Error: No redirect from HTTP
message.
Checking libwebsockets.org using https://hstspreload.org/?domain=libwebsockets.org claims that there is no redirect for http. But there is
I have tried the location with and without the final /.
Browsers and wget / curl don't have any problem following the redirect, eg
I can see your server seems to take the redirect and come back on https / http/2.0 with
We reply with suitable headers and send it 7K of payload before setting END_STREAM OK... it seems normal from the server end.
Could you maybe take a look at what about that feels wrong to the go http client and the script?