> This page is for version V3 - Beta (default).
> For other versions, use one of these documentation indexes:
> - V3 - Beta (default): https://docs.authlyx.dev/v3/llms.txt
> - V2 - Legacy: https://docs.authlyx.dev/v2/llms.txt
> - V1 - End of support: https://docs.authlyx.dev/v1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.authlyx.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.authlyx.dev/_mcp/server.

# Country and VPN restrictions

> Country and VPN restrictions in AuthlyX, with examples and troubleshooting.

## Decide which connections your app accepts

Suppose MyApp is licensed for customers in selected countries. A country policy lets the developer reject sign-ins from other countries. A VPN/proxy policy can separately reject connections classified by the configured reputation service.

```mermaid
flowchart TD
    A[Connection reaches AuthlyX] --> B[Resolve address using trusted proxy configuration]
    B --> C[Check explicit IP rules and country policy]
    C --> D[Apply VPN or proxy policy and its exceptions]
    D --> E[Continue identity authentication or reject]
```

## Country is approximate

The country comes from the observed IP address. It is not GPS and it cannot establish a person's physical location. Corporate networks, mobile carriers and VPN exit nodes can change the country an address maps to.

Open the app's Access Policies to choose blocked countries and connection rules. Test an allowed country and a blocked country with known addresses. Testing only localhost does not prove that country restrictions work.

## VPN exceptions are not a general whitelist

A VPN exception should allow the selected address through the VPN check without turning every other address into a denied connection. A restrictive IP whitelist has a different purpose: it limits access to the listed addresses. Country rules still apply according to the policy; a VPN exception is not a universal bypass.

## Configure the proxy correctly

In production the API may receive traffic through Cloudflare or another reverse proxy. Only trust forwarding information from the proxies you explicitly configure. A caller must not be able to choose their country by supplying an arbitrary address header.

If VPN detection is enabled and the reputation service cannot make a decision, the current API rejects the check rather than silently accepting an unverified result. Plan how your app explains that temporary failure. Do not describe an unavailable lookup as proof the customer uses a VPN.

These checks are additional access rules. They do not replace license validation, session checks or protection of valuable operations on your own server.