HTTPError.net

The fastest way to diagnose, understand, and fix any HTTP status code

511 Network Authentication Required

Fault: Neither
TL;DR

Network authentication required (captive portal).

The client needs to authenticate to gain network access.

What HTTP 511 Network Authentication Required Means

The client needs to authenticate to gain network access.

Network authentication required (captive portal).

Common Causes

How to Fix It (For Visitors)

How to Fix It (For Developers/Admins)

Returning a 511 Network Authentication Required (Code Examples)

If you build APIs or web apps, here is how to send an HTTP 511 response and how to test for it:

Node.js (Express)

app.get('/resource', (req, res) => {
  res.status(511).json({ error: 'Network Authentication Required' });
});

Python (Flask)

@app.route('/resource')
def resource():
    return jsonify(error='Network Authentication Required'), 511

PHP

<?php
http_response_code(511);
header('Content-Type: application/json');
echo json_encode(['error' => 'Network Authentication Required']);

Check the status with curl

curl -I https://example.com/resource
# Look for: HTTP/1.1 511 Network Authentication Required

Frequently Asked Questions

What does HTTP 511 Network Authentication Required mean?

Network authentication required (captive portal). In short: The client needs to authenticate to gain network access.

Is a 511 Network Authentication Required error my fault or the website's?

511 is a 5xx server-error code, so the problem is on the server side, not your browser or device. As a visitor you can usually only retry; if you run the site, investigate the server.

How do I fix a 511 Network Authentication Required error?

Implement captive portal detection. Handle authentication flow. Redirect to login page.

Official Specification

The 511 Network Authentication Required status code is defined in RFC 6585.

View the IANA HTTP Status Code Registry →