Skip to content

templates: httpInclude fails in 2.7.2 #5698

@bones-was-here

Description

@bones-was-here

We have HTML snippets included in our error handling and file browser templates, to add headers, footers, theming, etc without duplicating code manually (these snippet files are generated by hugo from HTML used in other areas of the site). In 2.6.4 this works well, but upgrading to 2.7.2 causes the httpInclude to fail. A blank white page with a 500 status is returned to the client, because the error can't be displayed properly since the error template fails to execute :) "http.log.error","msg":"error handling handler error"

The relevant error seems to be: "error":"{id=6kgdatjc0} templates.(*Templates).executeTemplate (templates.go:425): HTTP 500: template: /integ/error.html:7:4: executing \"/integ/error.html\" at <httpInclude \"/integ/favicon.html\">: error calling httpInclude: interface conversion: interface is nil, not net.Conn","first_error":{"msg":"template: file_server.html:40:5: executing \"file_server.html\" at <httpInclude \"/integ/favicon.html\">: error calling httpInclude: interface conversion: interface is nil, not net.Conn","status":500,"err_id":"ichdvhnp7","err_trace":"fileserver.(*FileServer).serveBrowse (browse.go:130)"}}

httpInclude is documented at https://caddyserver.com/docs/modules/http.handlers.templates
It looks like for our use case we could use include instead as these are static files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐞Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions