SSL certificate problem with select panelfield api option

Hi,
I’m currently trying to query a nested select field in a structure field. I got a solution from here.

I have set up a settings page with the following content:

  categories:
    type: tags
    label: Kategorien
    width: 1/2
  menu:
    type: structure
    fields:
      rubrik:
        label: Rubrik
        type: pages
        multiple: false
      cat:
        label: Kategorie
        type: multiselect
        options: query
        query:
          fetch: page.categories.split
          text: "{{ arrayItem.value }}"
          value: "{{ arrayItem.value }}"

In addition, I was able to set up a route with a json response:

            'pattern' => 'lesen-article-category.json',
            'action' => function () {
                $categories = array();
                foreach (site()->draft('settings')->menu()->toStructure() as $filterCategory) {
                    if ($filterCategory->rubrik()->toPage()->title() == "Lesen") {
                        foreach ($filterCategory->cat()->split(",") as $category) {
                            $categories[] = $category;
                        }
                    }
                }
                return response::json($categories);
            }

This works so far and I get an Array with the content of the multi-select field when I call the url.

On a different page I want to use the json response for a select field with the api option:

      category:
        label: Kategorie
        type: select
        required: true
        options: api
        api:
          url: "{{ site.url }}/lesen-article-category.json"
          text: "{{ item }}"
          value: '"{{ item.name }}":"{{ item }}"'

Unfortunately, I then get the following error message in the panel:
image

Am I missing something here?

I assume, with self-signed certificate, you will need to configure the ca option, as it is described here: remote | Kirby CMS

In your local environment there should not be a problem to set this to false, but you can also configure your own CA.

Thank you! The false option worked out. I guess this shouldn’t be used in production as indicated.

I’m not very familiar with configuring a CA file. Do have any recommendations or resources on how to do that? That’d be great!

By no means!

This depends on how you created your certificate. Usually, first there is your own CA, and then your self-signed certificate.

On the other hand, you can always create the necessary file by means of openssl, if you use it as a client, like when testing a ssl connection:

openssl s_client -showcerts -servername MYSERVER -connect MYSERVER:443 > cacert.pem
quit

Save the file cacert.pem where your webserver can reach it and configure the full path in Kirby’s config.php as it is outlined in the documentation above.

Or, think about using full featured certificates issued from Let’s Encrypt, which is definitely much less hassle then self-signed certs, even locally on your home computer. Actually I can hardly remember when I had last use self-sigend cert since Let’s Encrypt has started its service…