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

Custom hostnames - addHostname does not work #230

Open
4ice opened this issue Oct 13, 2022 · 2 comments
Open

Custom hostnames - addHostname does not work #230

4ice opened this issue Oct 13, 2022 · 2 comments

Comments

@4ice
Copy link

4ice commented Oct 13, 2022

When I try to execute the following:

new CustomHostnames($this->adapter)->addHostname(
            "zone_id",
            "mydomain.com",
        );

I get the error message: Unable to decode the JSON request body. Please check your input and try again..

I tried to modify the addHostname-function and remove the ssl-array, and by doing that, I could successfully create a custom hostname.

I am using a free-plan account on cloudflare.

@arommelaere
Copy link

arommelaere commented Feb 17, 2024

Same for me, removing

//            'ssl' => [
//                'method' => $sslMethod,
//                'type' => $sslType,
//                'settings' => $sslSettings,
//                'wildcard' => $wildcard,
//            ],

fix the issue on free plan

Solution is to change this in the package
array $sslSettings = [], to array|null $sslSettings = null,

@arommelaere
Copy link

arommelaere commented Feb 17, 2024

If anyone want my fix

update your composer.json

require
"cloudflare/sdk": "dev-patch-addHostname"

and add

    "repositories": {
        "repo-name": {
            "type": "vcs",
            "url": "https://github.com/arommelaere/cloudflare-php"
        }
    }

then composer update

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