URL with Address+Port
- As mentioned in
RFC 5952
Section 6, when you want to specify the port number in a URL, you may
type it as "[2001:db8::1]:80".
- The following three URLs will show the same webpage, because Apache
listens on port 80 by default.
- http://pearl.csie.ncnu.edu.tw/
- http://163.22.22.66/
- http://[2001:e10:6840:22:240:f4ff:fee9:14ae]/
- http://pearl.csie.ncnu.edu.tw:80/
- http://163.22.22.66:80/
- http://[2001:e10:6840:22:240:f4ff:fee9:14ae]:80/
- You may visit a webpage on another port:
- http://pearl.csie.ncnu.edu.tw:8006/
- http://[2001:e10:6840:22:240:f4ff:fee9:14ae]:8006/
- If you inspect the packets in Wireshark, they look similar.
Please look at the fields of IP addresses and port numbers.
Although the URL representation in a browser looks different, they
packets they send to the WWW server are the same.
- PS: I run my Flask script by
- flask --app my_ip_addr.py run --host '::' --port 8006
However, this makes it listen to IPv6 only.
On the contrary, if I run
- flask --app my_ip_addr.py run --host '' --port 8006
It listens to IPv4 only.
- Bonus: Can you find a way to make my Flask program listen to both
IPv4/IPv6?