# ================================================================
# Gujarat Home Guard Guard Portal - Camera Permission Policy Fix
# Upload/merge into:
# public_html/new/portalarea/guard-portal/.htaccess
# ================================================================

<IfModule mod_headers.c>

    # Remove restrictive headers inherited from root/public_html rules.
    Header unset Permissions-Policy
    Header always unset Permissions-Policy

    Header unset Feature-Policy
    Header always unset Feature-Policy

    # Allow this same website to use the camera.
    # Microphone remains blocked because face verification needs video only.
    Header always set Permissions-Policy "camera=(self), microphone=(), geolocation=(self)"

    # Compatibility for older Android browsers.
    Header always set Feature-Policy "camera 'self'; microphone 'none'; geolocation 'self'"

</IfModule>

# Do not cache camera pages while testing.
<IfModule mod_expires.c>
    ExpiresActive Off
</IfModule>

<IfModule mod_headers.c>
    <FilesMatch "^(face-enroll|face-verify|camera-diagnostic)\.php$">
        Header always set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
        Header always set Pragma "no-cache"
        Header always set Expires "0"
    </FilesMatch>
</IfModule>