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

Zone AccessRules return 404 due to duplicated // #89

Open
redemption opened this issue Mar 22, 2019 · 1 comment
Open

Zone AccessRules return 404 due to duplicated // #89

redemption opened this issue Mar 22, 2019 · 1 comment

Comments

@redemption
Copy link

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.

@fmp777
Copy link

fmp777 commented Mar 23, 2019

(sorry just side note - i hope this stays maintained! not every server has luxury of going php7 as of yet - which is requirement on the official sdk)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants