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 doesn't work #1115

Closed
fahrradflucht opened this issue Oct 18, 2016 · 5 comments
Closed

Caddyfile doesn't work #1115

fahrradflucht opened this issue Oct 18, 2016 · 5 comments
Labels

Comments

@fahrradflucht
Copy link

2016/10/18 21:30:44 webserver-configs/Caddyfile:9 - Parse error:
Wrong argument count or unexpected line ending after 'status'
➜  ~  caddy -version
Caddy 0.9.3
@rhukster rhukster added the bug label Oct 18, 2016
@flaviocopes
Copy link
Contributor

Confirmed, worked with the Caddy version available when it was written (0.8.2), now it does not work any more.

@flaviocopes
Copy link
Contributor

In particular, status is not working any more. A simpler Caddyfile like

localhost:8089 {
    gzip
    fastcgi / 127.0.0.1:9000 php
    rewrite {
        regexp .*
        ext    /
        to     /index.php?_url={uri}
    }
}

works fine. Looking into what changed.

@fahrradflucht
Copy link
Author

I found this yesterday but I'm not sure if it's related. I fixed it by rewriting to a path that I then put a status rule on. Like so:

rewrite {
    r /(.git|cache|bin|logs|backups|tests)/.*$
    to /denyaccess
}

rewrite {
    r /(system|vendor)/.*\.(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|bat)$
    to /denyaccess
}

status 403 /denyaccess

but this seems kind of dirty doesn't it?

@flaviocopes
Copy link
Contributor

With the Caddyfile format changes, I think it's the only way - pinged on the Caddy repo to check if there's another solution.

@flaviocopes
Copy link
Contributor

Went on with the solution you proposed, which fixes the problem. Also kept a Caddyfile version for older releases, since this syntax does not work anymore for Caddy 0.8.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants