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.