Integrate with IIS
Support level: Community
What is IIS?
Internet Information Services (IIS) for Windows Server is a flexible, secure and manageable Web server for hosting anything on the Web.
This guide uses authentik's proxy provider to protect an IIS-hosted site.
Preparation
The following placeholders are used in this guide:
iis.companyis the FQDN of the IIS site that users access.authentik.companyis the FQDN of the authentik installation.
This documentation lists only the settings that you need to change from their default values. Be aware that any changes other than those explicitly mentioned in this guide could cause issues accessing your application.
authentik configuration
To support the integration of IIS with authentik, you need to create an application/provider pair in authentik and assign it to a proxy outpost.
Create an application and provider in authentik
-
Log in to authentik as an administrator and open the authentik Admin interface.
-
Navigate to Applications > Applications and click New Application to open the application wizard.
- Application: provide a descriptive name, an optional group for the type of application, the policy engine mode, and optional UI settings.
- Choose a Provider type: select Proxy Provider as the provider type.
- Configure the Provider: provide a name (or accept the auto-provided name), the authorization flow to use for this provider, and the following required configurations.
- Set Mode to Proxy.
- Set External host to
https://iis.company. - Set Internal host to the URL of the IIS backend site as reached by the authentik proxy outpost, such as
http://localhost:8080.
- Configure Bindings (optional): you can create a binding (policy, group, or user) to manage the listing and access to applications on a user's Application Dashboard page.
-
Click Submit to save the new application and provider.
Configure proxy outpost
The proxy provider requires an authentik proxy outpost. If you do not already have a proxy outpost, follow the outpost documentation to create and deploy one.
Add the IIS application to a proxy outpost that will serve it:
- Log in to authentik as an administrator and open the authentik Admin interface.
- Navigate to Applications > Outposts.
- Click the edit icon for the proxy outpost.
- Under Available Applications, select the IIS application and move it to Selected Applications.
- Click Update to save your changes.
IIS configuration
- Proxy outpost
- IIS reverse proxy
Use this option when the authentik proxy outpost should receive requests for https://iis.company.
- Configure DNS or your reverse proxy so that
iis.companyroutes to the authentik proxy outpost. - Configure the IIS backend site so that it is reachable from the authentik proxy outpost at the Internal host URL.
- If the IIS backend site runs on the same Windows server, use a separate binding or port for the backend site, such as
http://localhost:8080.
No SSO configuration is required in IIS for this option. The authentik proxy outpost authenticates the user before forwarding allowed requests to IIS.
Use this option when IIS should receive requests for https://iis.company and forward them to the authentik proxy outpost. The authentik proxy outpost then forwards authenticated requests to the IIS backend site.
preserveHostHeader is a server-level ARR setting. Review other IIS reverse proxy sites before changing it on a shared IIS server.
-
Install the IIS URL Rewrite module and Application Request Routing.
-
In IIS Manager, select the server node, open Application Request Routing Cache, click Server Proxy Settings, enable Enable proxy, and apply the change.
-
From an elevated Command Prompt, configure ARR to preserve the original host header and avoid rewriting response
Locationheaders:Administrator Command Prompt%windir%\System32\inetsrv\appcmd.exe set config -section:system.webServer/proxy /preserveHostHeader:"True" /reverseRewriteHostInResponseHeaders:"False" /commit:apphost -
Configure the public IIS site for
iis.companyto proxy requests to the authentik proxy outpost.If the site already has a
web.configfile, merge therewritesection into the existingsystem.webServersection.web.config<?xml version="1.0" encoding="UTF-8"?><configuration><system.webServer><rewrite><rules><rule name="authentik proxy outpost" stopProcessing="true"><match url="(.*)" /><action type="Rewrite" url="http://authentik.company:9000/{R:1}" /></rule></rules></rewrite></system.webServer></configuration>This example uses the outpost HTTP port. If the outpost uses HTTPS, use
https://authentik.company:9443/{R:1}. -
Configure the IIS backend site so that it is reachable from the authentik proxy outpost at the Internal host URL. The backend site must use a different binding, hostname, or port than the public IIS reverse proxy site to avoid routing requests back to itself.
Configuration verification
To confirm that authentik is properly configured with IIS, open the IIS site. You should be redirected to authentik before the IIS site is shown.