Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FirewallRuleOptions is missing the new managed_challenge option #232

Open
Kovah opened this issue Dec 20, 2022 · 2 comments
Open

FirewallRuleOptions is missing the new managed_challenge option #232

Kovah opened this issue Dec 20, 2022 · 2 comments

Comments

@Kovah
Copy link

Kovah commented Dec 20, 2022

The class Cloudflare\API\Configurations\FirewallRuleOptions used while creating or updating firewall rules is missing the new managed_challenge option.

@garethjax
Copy link

i have noticed the same issue, i cannot find a way to se the firewall rules to "manage challenge"

@Kovah
Copy link
Author

Kovah commented Jan 26, 2023

I fixed this by extending the class and manually adding the option:

<?php

namespace App\Helper\Cloudflare;

class FirewallRuleOptions extends \Cloudflare\API\Configurations\FirewallRuleOptions
{
    public function setActionManagedChallenge(): void
    {
        $this->configs['action'] = 'managed_challenge';
    }
}

use it like that:

use App\Helper\Cloudflare\FirewallRuleOptions;

$firewallRuleOptions = (new FirewallRuleOptions());
$firewallRuleOptions->setActionManagedChallenge();

$firewall->updateFirewallRule(
    'your_zone_id',
    'your_rule_id',
    'your_filter_id',
    'new_filter_expression',
    $firewallRuleOptions
);

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

No branches or pull requests

2 participants