CONTENTS
--------

 * Introduction
 * Dependencies
 * Configuration
 * Decoupled / headless sites

INTRODUCTION
------------

The IP login module allows users to be automatically logged in based on their
IP address. IP addresses or ranges are configured on user accounts via the
"Login IP Address" field.

DEPENDENCIES
------------

The module depends on field_ipaddress. This module contains a special IP address
field that can handle IP ranges in a way that allows fast querying.

CONFIGURATION
-------------

Navigate to Administration > Configuration > People > IP Login
(/admin/config/people/ip_login).

 * Login automatically: When enabled, the module will attempt to log in anonymous
   users automatically on every page request based on their IP address.

 * Login form: When enabled, an additional "Log in automatically by IP" link is
   added to the user login form when a matching IP is detected.

 * Path specific IP logins: Restrict which pages trigger IP login by listing
   paths. Use the radio buttons to choose whether the listed paths are included
   or excluded from IP login.

 * Excluded paths: Paths listed here are completely excluded from IP login
   processing. Requests matching these paths will not trigger session
   initialization, cookie handling, or IP database lookups. This is useful for
   API endpoints (e.g. /jsonapi/*, /oauth/*) that should be fully cacheable by
   reverse proxies such as Fastly or Varnish. The '*' character is a wildcard.
   This setting has no effect when empty (default).

DECOUPLED / HEADLESS SITES
--------------------------

In a decoupled architecture where a frontend application (e.g. Nuxt.js, Next.js)
proxies requests to Drupal's JSON:API, the Drupal backend sees the frontend
server's IP address, not the end user's IP address. This means IP-based
auto-login will not work for frontend visitors.

For decoupled sites, the recommended approach is:

 1. Machines that need IP auto-login should access the Drupal backend URL
    directly (e.g. set the browser homepage to the backend URL). The backend
    can then redirect to the frontend after login.

 2. Use the "Excluded paths" setting to exclude API endpoints, like the list
 below, so that the middleware does not degrade cache performance on requests that will never trigger an IP login.

 /jsonapi
 /jsonapi/*
 /oauth
 /oauth/*
 /subrequests
 /subrequests/*

If IP auto-login is needed for decoupled frontend users, a different approach
such as client-side redirect-based login or CDN-level IP detection (e.g. Fastly
VCL) would be required.
