-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
Dynamic API URLs stopped working with ".test" Domains in 3.4.x #2804
Comments
If there was no point I missed, I couldn't reproduce the issue on 3.4.2 🤔 Blueprint fields:
test:
label: Checkboxes
type: checkboxes
options: api
columns: 2
api:
url: "{{ site.url }}/test.json"
text: "{{ item.text }}"
value: "{{ item.value }}" Config return [
'debug' => true,
'routes' => [
[
'pattern' => 'test.json',
'action' => function () {
return json_encode([
[
'value'=> 'APPLE',
'text'=> 'Apple'
],
[
'value'=> 'INTEL',
'text' => 'Intel'
],
[
'value'=> 'MICROSOFT',
'text' => 'Microsoft'
]
]);
}
]
]
]; Output |
Update: At least for local development it might be related to the |
@afbora Thanks for testing, I updated the headline and description, as it seems that the issue is related to the |
@helllicht Could this be a valet issue? laravel/valet#736 |
It looks to me like a host problem as well. We switched to cURL for the API calls and no longer use file_get_contents. That's why the host check is probably different. |
@bastianallgeier @afbora Thanks for chiming in. You're absolutely right, thanks for the hint. We were able to resolve it following one of the suggestions in the issue thread. 👍 The change to cURL also explains why it stopped working after the update to 3.4.0 Unfortunately this also means that API calls on password protected servers (like staging server) won't work. But I guess that's an issue for another day :) |
Describe the bug
Up until 3.4.0 it was able to define dynamic API urls via query builder syntax in checkbox blueprint fields.
E.g.
url: "{{ site.url }}/some.json"
The important part here is the
site.url
which would dynamically set the site's url for calling the right route.In this example it would return a json object from a custom Kirby Route that would populate the checkbox field (see example further below)
This was working perfectly fine until updating to 3.4.0, where it stopped working.
Now, when calling the respective page in the backend, it would show the following error:
Locally:
Could not resolve: your-domain.test (Domain name not found)
On Production:See Update 2Invalid options format
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The field should list the checkbox items based on the content of the json from the route
Kirby Version
3.4.0 / 3.4.1 / 3.4.2
Update: At least for local development it seems to be be related to the
.test
Domain.Switching the url to a hardcoded
url: "http://localhost:3000/some/route.json"
resolves the issue locally.Update 2:
Updated the issue and description as the problems in local/prod are coincidentally and not related to each other.
The
Invalid options
are a result of the password protection on the live domain. That's an a different issue in general.The text was updated successfully, but these errors were encountered: