getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.27k stars 167 forks source link

[Cms] Representation page not found with Caddy server #959

Closed vauvarin closed 6 years ago

vauvarin commented 6 years ago

Tested on the last Starterkit of Beta 5:

<?php

$data = [
  'title' => $page->title()->value(),
  'text'  => $page->text()->kirbytext()->value()
];

echo json_encode($data);

saved as site/templates/article.json.php

When I try to access to the page with the URL localhost/article.json I get an "error 404 page" instead. It works on server like Apache but not with Caddy server.

lukasbestle commented 6 years ago

Is that 404 error page one that is generated by Caddy, one that looks like Kirby or a plain text error? Can you post a screenshot?

omz13 commented 6 years ago

@vauvarin There is something wrong with your caddy configuration because representations work for me using Caddy.

You only need:

    rewrite {
         to {uri} {uri}/ /index.php{uri}
    }

The rewrite rules were more complex for kirby2 (/site and /panel had special handling), but for kirby3 that is all you need - literally one rule.

Can you post your Caddy config file (or DM it to me on slack).

vauvarin commented 6 years ago

@lukasbestle the 404 looks like a Kirby one: screenshot from 2018-09-17 19-10-22

@omz13 I use the same Rewrite rule, this is my Caddyfile: Caddyfile.txt

@omz13 Which version of Caddy do you use?

omz13 commented 6 years ago

@vauvarin yes, that’s Kirby’s 404. Could you try with php 7.1 instead of 7.2? I’m running caddy 0.11.0.

vauvarin commented 6 years ago

I use caddy 0.11.0 as well and I got the same issue when switching to php7.1-fpm I have built my Caddy binary with the Git plugin and go1.10.1, maybe it has an incidence?

@omz13 Could you send me your Caddy binary with weTransfer https://wetransfer.com/ My email is gillesvauvarin@gmail.com Thx

vauvarin commented 6 years ago

@bastianallgeier as you have my project as zip file now, could you just test my representation files with your environment to see if it's mine which is involve?

localhost/issue.json localhost/job.jso localhost/allissues.rss

bastianallgeier commented 6 years ago

@vauvarin I found the issue. You don't have regular templates for those pages. Content representations get only loaded correctly if you also provide a regular template.

vauvarin commented 6 years ago

Sorry to come back to this issue but as I said in the first comment above, I also have a 404 error when testing on a clean install Starterkit of Beta 5 :-/