Port 80 (HTTP)
Key facts
- Port
- 80
- Protocols
- TCP
- Range
- System port (Well-Known), 0-1023
- IANA service name
- http, www, www-http
IANA assigns ports in this range to well-known services, under RFC 6335.
About port 80
Port 80 is the default port of HTTP, the protocol browsers and web servers use to transfer pages and files, over TCP. The connection on port 80 isn't encrypted, so today it's used mainly to automatically redirect visitors to the secure version of the site on port 443.
HTTP semantics are defined in RFC 9110, and IANA registers port 80 for the http service.
What port 80 is used for
- Redirect to HTTPS: a visitor who types an address without https first reaches port 80, and the server sends a permanent redirect (301) to the https address.
- SSL certificate validation: certificate authorities such as Let's Encrypt validate domain ownership with the HTTP-01 method, through a request to port 80.
- Internal services: services on an internal network, or behind a proxy server that handles encryption, sometimes listen on plain HTTP.
Port 80 in the firewall
On a web server, open port 80 to incoming traffic from any address, together with port 443, even when the whole site runs on HTTPS. Closing port 80 breaks the automatic redirect of visitors who type an address without https, and may cause renewals of SSL certificates validated with the HTTP-01 method to fail.
- UFW:
ufw allow 80/tcp - firewalld:
firewall-cmd --permanent --add-service=http
A server that doesn't serve websites, such as a database server, doesn't need port 80 open.
Risks and security
Traffic on port 80 travels unencrypted, so never send passwords, forms, or personal data over it. The solution is to redirect all traffic to HTTPS and keep only the redirect on port 80.
- Set up a permanent redirect (301) from http to https for every address on the site.
- Add the Strict-Transport-Security (HSTS) header, so the browser connects directly over HTTPS on later visits.
- Make sure the site has no links or files loaded over http, to avoid mixed content warnings.
- On a server that hosts several sites, make sure a request to the server's IP address without a domain name doesn't show a default page with information about the server.
Commands to check and configure
-
ss -tlnp | grep ':80 'Shows which web server is listening on port 80.
-
curl -I http://example.comShows the response headers, including the status code and the redirect target.
-
curl -sI http://example.com | grep -i locationShows only the redirect target address, to make sure it leads to https.
-
nc -zv example.com 80Checks whether port 80 on the server is open and reachable.
-
ufw allow 80/tcpOpens port 80 to incoming traffic (UFW).
-
firewall-cmd --permanent --add-service=httpOpens port 80 to incoming traffic in firewalld. Then run firewall-cmd --reload.
Port 80 in the IANA registry
| Port | Protocol | Service | IANA registry description |
|---|---|---|---|
| 80 | SCTP | http | HTTP |
| 80 | TCP | http | World Wide Web HTTP |
| 80 | TCP | www | World Wide Web HTTP |
| 80 | TCP | www-http | World Wide Web HTTP |
| 80 | UDP | http | World Wide Web HTTP |
| 80 | UDP | www | World Wide Web HTTP |
| 80 | UDP | www-http | World Wide Web HTTP |
Data source: IANA Service Name and Transport Protocol Port Number Registry (opens in a new tab)
Port 80 FAQ
Should port 80 stay open when my site runs on HTTPS?
Yes. Port 80 receives visitors who type an address without https and redirects them to the secure version, and many SSL certificates renew through validation over port 80. When the site redirects all traffic to HTTPS, an open port 80 doesn't weaken the site's security.
How do I redirect all traffic from HTTP to HTTPS?
Set up a permanent redirect (301) on the web server from every http address to the matching https address. On Apache servers, you can do this in the .htaccess file, and the .htaccess cheat sheet has a ready-made example. After the redirect, we recommend also adding the HSTS header.
What's the difference between port 80 and port 8080?
Port 80 is the default HTTP port, so the browser connects to it when the address doesn't include a port number. Port 8080 is usually used for an additional HTTP service on the same server, such as a development environment, an admin interface, or a proxy server, and you have to state it explicitly in the address, for example example.com:8080.
Do HTTP/2 and HTTP/3 use port 80?
In practice, browsers use HTTP/2 and HTTP/3 only over an encrypted connection, on port 443. Over such a connection, HTTP/2 runs over TCP, while HTTP/3 runs over QUIC on UDP. Port 80 remains mainly for plain HTTP connections and the redirect to HTTPS.