IP Restriction for App Service on Linux


In order to restrict access to clients based on IP Address in App Service on Linux we need to add entries in the .htaccess file. For App Service on Windows click here.

In App Service on Linux, the visitor/client IP is made available to the web app through “X-Client-IP” environment variable. The log format is available here: /etc/apache2/apache2.conf.

NOTE: .htaccess is relevant for Apache based web apps only

In .htaccess file, we will use this field to allow or deny access to clients.

Allow specific IP-Address

Deny specific IP-Address

In the above configuration replace xxx.xxx.xxx.xxx with the corresponding client IP address.


Comments (2)

  1. Shenghan says:

    This post is misleading. App Service on Linux doesn’t support this feature at all. Method described in this post on works if your application happened to run on top of Apache server.

  2. Marco says:

    is this possible also with a custom docker container?

Skip to main content