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

Redirect adding trailing slash to dir removes path from label #2555

Closed
crater2150 opened this issue Apr 9, 2019 · 5 comments
Closed

Redirect adding trailing slash to dir removes path from label #2555

crater2150 opened this issue Apr 9, 2019 · 5 comments

Comments

@crater2150
Copy link

1. Which version of Caddy are you using (caddy -version)?

caddy-0.11.4 (voidlinux build)

2. What are you trying to do?

I'm trying to host a directory with several subdirectories in a user's home folder under a fixed path.

3. What is your Caddyfile?

qwertyuiop.de:443/~crater2150/ {
        tls /path/to/cert.pem /path/to/cert.key
        root /home/crater2150/www/
        browse
}

4. How did you run Caddy (give the full command and describe the execution environment)?

Provided voidlinux runit script, also caddy without further options, no difference.

5. Please paste any relevant HTTP request(s) here.

Working request (existing directory):
curl -v https://qwertyuiop.de/\~crater2150/photo/
Failing request (no trailing slash)
curl -v https://qwertyuiop.de/\~crater2150/photo

6. What did you expect to see?

Caddy should redirect url without trailing slash to same url with trailing slash, if it is a directory, i.e. HTTP header:

location: /~crater2150/photo/

7. What did you see instead (give full error messages and/or log)?

Caddy redirects to url with trailing slash added, but removes path from label in config file, i.e.:

location: /photo/

8. Why is this a bug, and how do you think this should be fixed?

The rewrite adding a slash for directories should preserve the full url, including a path matching in the label.

9. What are you doing to work around the problem in the meantime?

I tried using rewrite to work around it with no success yet.

Bonus: What do you use Caddy for? Why did you choose Caddy?

Private server with several proxied services like radicale etc. and some plain file directories. I chose Caddy, because of it's nice and clean config file syntax.

@htfy96
Copy link

htfy96 commented Apr 19, 2019

Experienced the same issue. Have you tried downgrading to a previous version?

@skyzh
Copy link

skyzh commented Apr 19, 2019

There is also a problem with Caddy browse template, where all hrefs are defined as ./{path}. If there's no / at the end, the browser will wrongly resolve this link.

@skyzh
Copy link

skyzh commented Apr 24, 2019

@mholt
Copy link
Member

mholt commented Oct 11, 2019

Can you actually try this with Caddy 2 (currently in beta on the v2 branch) and see if this is still an issue?

I haven't tested much with how paths in the site address are handled yet, but I believe it's a bit different in v2.

@mholt
Copy link
Member

mholt commented Mar 2, 2020

Closing due to lack of activity

@mholt mholt closed this as completed Mar 2, 2020
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

4 participants