Skip to content

Latest commit

 

History

History
53 lines (38 loc) · 2.94 KB

wordpress_enable_microphone_camera.md

File metadata and controls

53 lines (38 loc) · 2.94 KB

How to enable Microphone and Camera with WordPress App Service

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.

Permissions-Policy-Violation-Microphone-Camera

Steps

  1. 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
  2. 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) or microphone(*) or microphone(). 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).

  3. 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
  4. 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
    
  5. 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
  6. Now Restart your App Service and validate if microphone or camera are working properly.

References: