Web Development

How to fix error 403 Woocommerce mobile app.

How To Fix Error 403 WooCommerce Mobile App

Trying to connect your store with WooCommerce mobile app.

You happen to get a notice saying

Couldn’t connnect. We received a 403 error when trying to access your site’s XMLRPC endpoint. The app needs that in order to communicate with your site. Contact your host to solve this problem.

App connects to WordPress site via xmlrpc.php API. This is the WordPress App API endpoint. Configuring mod security correctly should allow access to this file.

Solution

Add this code in .htaccess file. Note that the below code only works if your host has enabled ‘AllowOverride‘ for you to override SecFilterInheritance. If the code does not work, ask your host to allow you to override the settings so the WordPress App can communicate with your self-hosted site via xmlrpc.php.

<IfModule mod_security.c> SecFilterInheritance Off </IfModule> <Files xmlrpc.php> SecFilterInheritance Off </Files>

Common HTTP status codes

Here are some of the most common HTTP status codes that you should be alert to:

  1. 2xx – Success:

    • 200 OK: The request was successful, and the response contains the requested data.
    • 201 Created: The request has successfully created a new resource on the server.
    • 204 No Content: The request was successful, but there is no data to return (often used for DELETE requests).
  2. 3xx – Redirection:

    • 301 Moved Permanently: The requested resource has been permanently moved to a different URL.
    • 302 Found (or 303 See Other): The resource is temporarily located at a different URL. The client should use the new URL for future requests.
    • 304 Not Modified: The resource has not been modified since the last request. Typically used with caching mechanisms.
  3. 4xx – Client Errors:

    • 400 Bad Request: The server couldn’t understand the client’s request due to malformed syntax or missing parameters.
    • 401 Unauthorized: Authentication is required, and the credentials provided are invalid or missing.
    • 403 Forbidden: The client is authenticated but does not have permission to access the requested resource.
    • 404 Not Found: The requested resource could not be found on the server.
    • 405 Method Not Allowed: The HTTP method used in the request is not allowed for the specified resource.
  4. 5xx – Server Errors:

    • 500 Internal Server Error: A generic error message indicating that something has gone wrong on the server.
    • 502 Bad Gateway: The server, while acting as a gateway or proxy, received an invalid response from the upstream server.
    • 503 Service Unavailable: The server is currently unable to handle the request due to temporary overloading or maintenance.
  5. Custom Status Codes:

    • Some APIs and web applications define custom status codes to convey specific application-level information. It’s important to refer to the API documentation or server documentation for details on custom codes.

Handling these status codes appropriately in your code allows you to provide meaningful feedback to users and implement error handling and recovery strategies. For example, you might want to display a friendly error message to users for 404 errors or retry a failed request for a 502 Bad Gateway error. Proper error handling can improve the user experience and the reliability of your web application.