Search code examples
phpapachefile-upload

403 Forbidden error when uploading files from Postman to PHP API


I am trying to upload files from Postman using PHP API. I'm getting a 403 forbidden error:

<html>

<head>
    <title>403 Forbidden</title>
</head>

<body>
    <center>
        <h1>403 Forbidden</h1>
    </center>
</body>

</html>

Update #2

Update #3 These are the contents of /etc/apache2/apache2.conf

The following lines prevent .htaccess and .htpasswd files from being viewed by Web clients.

<FilesMatch "^.ht"> Require all denied


Solution

  • The key was to Override to allow the AWS-AWSManagedRulesCommonRuleSet rule in AWS WAF for the ALB (application load balancer). Once this rule was overridden, the file upload worked fine!