authelia/docs/content/en/integration/proxies/swag.md

4.4 KiB

title description lead date draft images menu weight toc aliases
SWAG An integration guide for Authelia and the SWAG reverse proxy A guide on integrating Authelia with SWAG. 2022-05-17T10:57:38+10:00 false
integration
parent
proxies
351 true
/i/swag

SWAG is a reverse proxy supported by Authelia. It's an NGINX proxy container with bundled configurations to make your life easier.

Important: When using these guides it's important to recognize that we cannot provide a guide for every possible method of deploying a proxy. These guides show a suggested setup only and you need to understand the proxy configuration and customize it to your needs. To-that-end we include links to the official proxy documentation throughout this documentation and in the See Also section.

Introduction

As SWAG is a NGINX proxy with curated configurations, integration of Authelia with SWAG is very easy and you only need to enabled two includes.

Note: All paths in this guide are the locations inside the container. You will have to either edit the files within the container or adapt the path to the path you have mounted the relevant container path to.

Requirements

SWAG supports the required NGINX requirements for Authelia out-of-the-box.

Trusted Proxies

Important: You should read the Forwarded Headers section and this section as part of any proxy configuration. Especially if you have never read it before.

To configure trusted proxies for SWAG see the NGINX section on Trusted Proxies. Adapting this to SWAG is beyond the scope of this documentation.

Prerequisite Steps

These steps must be followed regardless of the choice of subdomain or subpath.

  1. Deploy Authelia to your docker network with the container_name of authelia and ensure it's listening on the default port and you have not configured the Authelia server TLS settings.

Subdomain Steps

In the server configuration for the application you want to protect:

  1. Edit the /config/nginx/proxy-confs/ file for the application you wish to protect.
  2. Uncomment the #include /config/nginx/authelia-server.conf; line which should be within the server block but not inside any location blocks.
  3. Uncomment the #include /config/nginx/authelia-location.conf; line which should be within the applications location block.

Example

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name heimdall.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    # Authelia: Step 1.
    include /config/nginx/authelia-server.conf;

    location / {
        # Authelia: Step 2.
        include /config/nginx/authelia-location.conf;

        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        set $upstream_app heimdall;
        set $upstream_port 443;
        set $upstream_proto https;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;
    }
}

Subpath Steps

Note: Steps 1 and 2 only need to be done once, even if you wish to protect multiple applications.

  1. Edit /config/nginx/proxy-confs/default.
  2. Uncomment the #include /config/nginx/authelia-server.conf; line.
  3. Edit the /config/nginx/proxy-confs/ file for the application you wish to protect.
  4. Uncomment the #include /config/nginx/authelia-location.conf; line which should be within the applications location block.

Example

location ^~ /bazarr/ {
    # Authelia: Step 4.
    include /config/nginx/authelia-location.conf;

    include /config/nginx/proxy.conf;
    resolver 127.0.0.11 valid=30s;
    set $upstream_app bazarr;
    set $upstream_port 6767;
    set $upstream_proto http;
    proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
}

See Also