5.5 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-06-15T17:51:47+10:00 | false |
|
351 | true |
|
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.
Get Started
It's strongly recommended that users setting up Authelia for the first time take a look at our Get Started guide. This takes you through various steps which are essential to bootstrapping Authelia.
Requirements
SWAG supports the required NGINX requirements for Authelia out-of-the-box.
SWAG Caveat
One current caveat of the SWAG implementation is that it serves Authelia as a subpath for each domain. We strongly recommend instead of using the out of the box method and guide for SWAG that you follow the NGINX guide (which can be used with SWAG) and run Authelia as it's own subdomain.
This is partly because Webauthn requires that the domain is an exact match when registering and authenticating and it is possible that due to web standards this will never change.
In addition this represents a bad user experience in some instances as users sometimes visit the
https://app.example.com/auth
URL which doesn't automatically redirect the user to https://app.example.com
(if they
visit https://app.example.com
then they'll be redirected to authenticate then redirected back to their original URL).
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.
- Deploy Authelia to your docker network with the
container_name
ofauthelia
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:
- Edit the
/config/nginx/proxy-confs/
file for the application you wish to protect. - Uncomment the
#include /config/nginx/authelia-server.conf;
line which should be within theserver
block but not inside anylocation
blocks. - Uncomment the
#include /config/nginx/authelia-location.conf;
line which should be within the applicationslocation
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.
- Edit
/config/nginx/proxy-confs/default
. - Uncomment the
#include /config/nginx/authelia-server.conf;
line. - Edit the
/config/nginx/proxy-confs/
file for the application you wish to protect. - Uncomment the
#include /config/nginx/authelia-location.conf;
line which should be within the applicationslocation
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";
}