Skip to content
This repository was archived by the owner on Nov 2, 2022. It is now read-only.
This repository was archived by the owner on Nov 2, 2022. It is now read-only.

Zone AccessRules return 404 due to duplicated // #89

@redemption

Description

@redemption

I know you're not maintaining this since the official Cloudflare API is available now, but we still use your project so I thought I'd report this.

Recently we're starting to see 404 errors from the Zone\Firewall]\AccessRules class.

The returned output looks like this:

{ "code": 1000, "error": "not_found" }

It turns out the problem has to do with the request URL. All request URLs have a double // in them, which doesn't affect any of the API queries except for the zones one it seems.

Eg this works fine:

GET https://api.cloudflare.com/client/v4//user/firewall/access_rules/rules

But this will be a 404:

GET https://api.cloudflare.com/client/v4//zones/:zoneid/firewall/access_rules/rules

The reason why there are doubled // in the URL path is that all the requests look like this in the code:

return $this->get('/zones/'.$zone_id.'/firewall/access_rules/rules', $data);

But in the get request function it does this:

$url = 'https://api.cloudflare.com/client/v4/'.$path;

The fix is to to remove the extra / in the call to get, eg:

return $this->get('zones/'.$zone_id.'/firewall/access_rules/rules', $data);

Or more universally it's possible to remove the trailing / in the request function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions