This document provides the instruction on how to resolve the 'permissions-policy-violation' errors that you encounter in browser when using Microphone or Camera with your WordPress website. By default these headers are disabled in the Nginx Configuration and you can enable them using the steps below.
-
Go the SSH console of your App Service and run the below code only once. This copies the required nginx configuration file to the persistent storage under /home directory.
cp /etc/nginx/conf.d/spec-settings.conf /home/custom-spec-settings.conf
-
Edit /home/custom-spec-settings.conf using vi/vim editors. Search and update the Permissions-Policy header value as shown below. By default the allowlist for microphone and camera are set to none, and we are updating it to allow for
self
origin.Old Value
add_header Permissions-Policy "geolocation=(),midi=(),sync-xhr=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self)";
New value
add_header Permissions-Policy "geolocation=(),midi=(),sync-xhr=(),microphone=(self),camera=(self),magnetometer=(),gyroscope=(),fullscreen=(self)";
-
Please note that you can use
self
,*
, empty value (none), or any specific origin in the allowlist. For instance,microphone(self)
ormicrophone(*)
ormicrophone()
. For more information refer to Permissions-Policy Headers -
You can also edit the custom-spec-settings.conf file from the file manager by clicking on the
pencil
icon (https://<appname>.scm.azurewebsites.net/newui/fileManager
).
-
-
Now copy the following code snippet to /home/dev/startup.sh file.
cp /home/custom-spec-settings.conf /etc/nginx/conf.d/spec-settings.conf /usr/sbin/nginx -s reload
-
Now try to execute the startup.sh script from SSH console and see if there are any errors. You can validate if microphone and camera are working in the browser.
cd /home/dev ./startup.sh
-
If you see any errors related to supervisord process, then replace the code in /home/dev/startup.sh file with below one. Otherwise, ignore this step.
cp /home/custom-spec-settings.conf /etc/nginx/conf.d/spec-settings.conf kill $(ps aux | grep 'nginx' | awk '{print $1}') 2> /dev/null
-
Now Restart your App Service and validate if microphone or camera are working properly.