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

Add wildcards/globs to "internal" directive #2563

Closed
lewpayne opened this issue Apr 12, 2019 · 1 comment
Closed

Add wildcards/globs to "internal" directive #2563

lewpayne opened this issue Apr 12, 2019 · 1 comment
Labels
feature ⚙️ New feature or request v1 ⚰️ Specifically applies to v1 (EOL)

Comments

@lewpayne
Copy link

lewpayne commented Apr 12, 2019

Currently, the "internal" directive does not accept globs, wildcards, or regex. It accepts only a literal string base path, which is then compared to the path requested by the client. This makes it difficult to "set it and forget it" when it comes to similar paths.

For example, the following attempts to protect the "methods" directory (which contains files that are meant to be included or required by the php rpc server, but not by the webserver directly):

internal /www/website/rpc.domain.com/demo/v1/methods

When you later start adding customer endpoints (in lieu of "demo"), you need to remember to protect the new path, and you end up with this:

internal /www/website/rpc.domain.com/demo/v1/methods
internal /www/website/rpc.domain.com/cust1/v1/methods
internal /www/website/rpc.domain.com/cust2/v1/methods

Failure to remember to update the caddy config results in granting inadvertent access to said files. Instead, if the "internal" directive had simple globbing or wildcards, you could do this (in a truly "set it and forget it" manner):

internal /www/website/rpc.domain.com/*/*/methods

As an alternative, it would be great if "internal" could protect a particular file extension:

internal *.inc

Thank you.

@lewpayne lewpayne added the feature ⚙️ New feature or request label Apr 12, 2019
@mholt mholt added the v1 ⚰️ Specifically applies to v1 (EOL) label Mar 23, 2020
@mholt
Copy link
Member

mholt commented Jun 5, 2020

Since no new features are being developed for v1, and this is now possible in Caddy 2, (albeit not with the Caddyfile quite yet, I think you have to use JSON for the X-Accel-Redirect-esque behavior, but that can come in 2.1 or 2.2 maybe), I will be closing this issue. Thanks!

@mholt mholt closed this as completed Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature ⚙️ New feature or request v1 ⚰️ Specifically applies to v1 (EOL)
Projects
None yet
Development

No branches or pull requests

2 participants