https client 403 error

74 views
Skip to first unread message

vlya...@gmail.com

unread,
Dec 29, 2023, 1:53:05 PM12/29/23
to golang-nuts
I use generic https client code to perform GET:
tr := &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, }     
client := &http.Client{ Transport: tr,     }
req, err := http.NewRequest("GET", url, nil)
...
resp, err := client.Do(req)

for most urls it works fine but for some (https://www.indeed.com/ for example) i have the following error:

Response status: 403 Forbidden Msg:
Please enable cookies.

Does my client have to get cookie from server? How can implement that?
Thank you...

Sean Liao

unread,
Dec 29, 2023, 2:49:38 PM12/29/23
to golang-nuts
see https://pkg.go.dev/net/http#Client.Jar

- sean

- sean
> --
> You received this message because you are subscribed to the Google Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/80290cb7-6a87-4825-bfca-437c64d56596n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages