来源 https://www.zackwu.com/posts/2021-03-14-why-i-always-get-503-with-golang/
修复

package main

import (
    "crypto/tls"
    "fmt"
    "net/http"
)

func main() {
    defaultCipherSuites := []uint16{0xc02f, 0xc030, 0xc02b, 0xc02c, 0xcca8, 0xcca9, 0xc013, 0xc009, 
            0xc014, 0xc00a, 0x009c, 0x009d, 0x002f, 0x0035, 0xc012, 0x000a}
    client := http.Client{
        Transport: &http.Transport{
            TLSClientConfig: &tls.Config{
                CipherSuites: append(defaultCipherSuites[8:], defaultCipherSuites[:8]...),
            },
        },
    }
    req, err := http.NewRequest("GET", "https://www.bundesregierung.de/breg-en", nil)
    resp, err := client.Do(req)
    if err != nil {
        fmt.Println(err)
        return
    }
    defer resp.Body.Close()
    fmt.Println(resp.Status)
}

// Output:
// 200 OK

标签: http, 503, Service Unavailable

添加新评论