Yevgeniy Gendelman
Yevgeniy Gendelman

Reputation: 1255

Golang http server does not respond to ipv6 requests

My server runs on Ubuntu. I can ping my IPv6 address from external sites. When I test my domain name in https://ipv6-test.com/validate.php I get checks for AAAA DNS record, IPv6 DNS server, and IPv6 web server. The check for IPv6 server comes with a note: "cannot identify web server".

My server code:

package main

import (
  "log"
  "net/http"
)

func main() {
  fs := http.FileServer(http.Dir("./html"))
  http.Handle("/", fs)
  err := http.ListenAndServe(":80", nil)
  if err != nil {
    log.Fatal(err)
  }
}

Like in this question Golang IPv6 server, I can load my web page by domain name, by ip address, but not by IPv6 address (http://[2607:f1c0:1801:1b4::1]).

When I run

sudo ss -6lp

I get

Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port tcp LISTEN 0 128 *:http : users:(("go_webserver",pid=131015,fd=5))

me@localhost:~$ sudo netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0    448 1.2.3.4:22          11.12.13.14:49978      ESTABLISHED
tcp6       0      0 :::10000                :::*                    LISTEN
tcp6       0      0 :::21                   :::*                    LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN

Upvotes: 1

Views: 1165

Answers (1)

arun
arun

Reputation: 61

does your client machine where you are trying to access the site from browser have ipv6 support? you can check it with ping6 google.com ?

Upvotes: 1

Related Questions