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

Caddyfile example 'templates' entry seems to conflict #164

Closed
fwdIT opened this issue Jun 14, 2020 · 1 comment
Closed

Caddyfile example 'templates' entry seems to conflict #164

fwdIT opened this issue Jun 14, 2020 · 1 comment

Comments

@fwdIT
Copy link
Contributor

fwdIT commented Jun 14, 2020

Using latest caddy image and latest 4.* invoiceninja image

When trying to create an invoice on a clean install or trying to open invoice settings, I get this error:

web_1  | {"level":"error","ts":1592149644.1447153,"logger":"http.log.error","msg":"template: index.php:1315: function \"filesize\" not defined","request":{"method":"GET","uri":"/settings/invoice_settings","proto":"HTTP/2.0","remote_addr":"192.168.0.xxx:61945","host":"xxx","headers":{"Upgrade-Insecure-Requests":["1"],"Te":["trailers"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Firefox/78.0"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"],"Accept-Encoding":["gzip, deflate, br"],"Referer":["https://invoiceninja.vlan.app/settings/system_settings"],"Cookie":["ninja_session=xxx; XSRF-TOKEN=xxx; cookieconsent_status=dismiss"],"Accept-Language":["en-US,en;q=0.5"],"Dnt":["1"]},"tls":{"resumed":true,"version":772,"ciphersuite":4867,"proto":"h2","proto_mutual":true,"server_name":"xxx"}},"duration":0.193751456,"status":500,"err_id":"1hbc5i79t","err_trace":"templates.(*Templates).executeTemplate (templates.go:305)"}
app_1  | 172.28.0.26 -  14/Jun/2020:15:47:23 +0000 "GET index.php" 200

After some testing and in the end just logical thinking based on what I see above, it seemed that the app image (being the php invoiceninja one) gave a nice clean response with http code 200. It was however the caddy web image which started complaining. Took me some time to realise that it probably also wanted to handle the end result as a template for it's own internal templating which seems to fail. I suspect what the php image sends back has some content in tags which caddy wants to interpret.

In general I don't see any reason to have templates in the Caddyfile but I am new to both invoiceninja and caddy. Nevertheless, removing it makes these invoiceninja components work.

This is my working Caddyfile:

{$APP_URL} {
  root * /var/www/app/public
  php_fastcgi app:9000
  encode zstd gzip
  file_server browse
}
@codedge
Copy link
Contributor

codedge commented Jun 15, 2020

@fwdIT I'll have a look into that but what you found out looks very valid. I'l lget back to you soon.

codedge added a commit that referenced this issue Jun 23, 2020
Fixes #164 - caddy templating conflicts with php output
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