Using Caddy to proxy chevereto


(dani) #1

Hello, I am using caddy as a reverse proxy for my home server and am interested in using chevereto to share some family photos etc and things that we’d prefer to self-host.

I would install chevereto on a separate server from caddy and prefer to access it as a subdirectory eg. mydomain.com/chevereto or something but I’d be happy even if I got it to work with a subdomain like chevereto.mydomain.com.

I think part of the issue is that chevereto uses mod_rewrite to make pretty urls and I’m not sure how to configure caddy to handle that.

I saw a couple other posts on here regarding sites with mod_rewrite but they all have a bunch of complex regex statements and I’m hoping my problem is more simple than that.

  • When going to mydomain.com/chevereto, the website resolves but the URL gets rewritten to mydomain.com/login which does not exist and I get 404.

  • When going to chevereto.mydomain.com it simply times out and gives page cannot be displayed.

  • When going to http://localip the website displays and works perfectly.

  • Relevant resources:
    Here is the .htaccess file that chevereto uses.
    I also tried adding this example caddy file I found for chevereto, but I think this is just if you are running caddy and chevereto on the same server, not using caddy as proxy. At least, I wasn’t able to get the syntax right and caddy wouldn’t start.

Lastly, here is my caddyfile:

mydomain.com
{


  ext .html .htm
  root /caddy/www
  gzip
  tls me@email.com

  log /caddy/log/access.log {
    rotate_size 3
    rotate_age 90
    rotate_keep 25
  }

  header / {

    X-Content-Type-Options nosniff
    X-XSS-Protection "1; mode=block"
    Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
  }


  proxy /chevereto http://10.0.0.177  {
	transparent
  }}

chevereto.mydomain.com {

  log /caddy/log/chevereto.log {
    rotate_size 3
    rotate_age 90
    rotate_keep 25
  }


  gzip
  tls me@email.com
    proxy / http://10.0.0.177/ {

        transparent
    }
}

I should also mention: I am using CADDY 0.10.10


(dani) #2

Also, I checked access.log and found no errors, it does return 200 for /chevereto but that is the only entry. chevereto.log file has no entries at all

;/


(Matthew Fay) #3

Rewrites shouldn’t be your concern, because you’re not using Caddy to serve the files/PHP - it’s simply proxying back to another server.

Your issue with mydomain.com/chevereto is that the upstream app is probably behaving as though it were located at /. A request for /chevereto might not be valid upstream, and a request for any other location, as you’ve learned, is not proxied by Caddy because you’ve configured it only to proxy /chevereto and its sub-paths.

If you can configure the app somehow to use /chevereto as a URL base, this approach becomes feasible. Otherwise, the best option is to use a subdomain.

That (probably) means your requests for chevereto.mydomain.com aren’t reaching Caddy. Check your DNS properly resolves that subdomain to the IP address of your Caddy host.


(system) #4

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.