Comments (4)
I bet the bug is here:
reqExt := path.Ext(r.URL.Path)
for _, ext := range rule.Extensions {
if reqExt == ext {
"/" doesn't have a ".html" extension, so the comparison fails and the template doesn't get executed. Should be a simple matter of checking if the path is a directory first, and if so, if an index file exists.
Although, more middlewares are going to run into this issue. Right now the list of index files is actually defined in the browse middleware which the core fileServer references. But maybe this isn't the best way to do it.
Perhaps each middleware that needs it could have an IndexFiles []string
field that the application sets. (Of course, then we have to decide if an empty list defaults to index.html... etc.) To make this work well, I need to finish refactoring the config package and get those generator (New()
) functions out of the middleware packages.
Okay - in summary: the simple fix is to just have the template middleware look for index.<extension>
if the request is to a directory. That could hold us over for now, maybe?
from caddy.
Yeah, that sounds reasonable. Though this was enough to hold me over for now:
rewrite / /index.html
from caddy.
@ciarand This fix will go out at the next release. Thank you again for your bug report!
from caddy.
Sounds great, thanks @mholt!
from caddy.
Related Issues (20)
- all: Support the riscv64 platform HOT 3
- Improve error message when trying to define a global matcher HOT 3
- Issue with Caddy Server Configuration for Domain HOT 1
- v2.8.0-rc.1: panic: runtime error: invalid memory address or nil pointer dereference HOT 5
- Intermediate certificate expired without using specified root certificate HOT 2
- Set `sign_with_root` via Caddyfile HOT 3
- core: caddy unable to start with an empty $HOME HOT 5
- Using proxy_protocol v2 with h2c backend gives wrong IP address to backend. HOT 19
- TLS does not work on NATed IPv4 literal HOT 1
- Feature-Request: [Templates] include from string buffer HOT 2
- Permission denied when first run after fresh installation. HOT 11
- ZeroSSL Issuer can't use dns_challenge_override_domain HOT 4
- Client_ip not merged as remote_ip used to in "not" expression HOT 3
- v2.8 is a major breaking change: update to CertMagic breaks LegoDeprecated HOT 1
- the change to SanitizedPathJoin in v2.8.x can cause routing to break in certain configurations HOT 5
- Build amd64 and arm are broken HOT 3
- X-Accel-Redirect style of header matching is broken in handle_response
- using the file ext caddyfile for a config file does not work HOT 1
- Weighted Round-Robin strategy doesn't support zero values HOT 2
- regression in 2.8 file_server serving root index file HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from caddy.