Caddy: Proxy + without not working

Created on 3 Dec 2016  路  7Comments  路  Source: caddyserver/caddy

1. What version of Caddy are you running (caddy -version)?

0.9.3

2. What are you trying to do?

Proxy + without

3. What is your entire Caddyfile?

:2015 {
    ext .html
    gzip
    log / stdout
    proxy /api 8.8.8.8:8080/foo {
        without /api
    }
}

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

caddy
curl -X GET http://127.0.0.1:2015/api/bar

5. What did you expect to see?

"GET /foo/bar HTTP/1.1"

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

127.0.0.1 - [02/Dec/2016:21:54:14 +0100] "GET /foo/api/bar HTTP/1.1" 502 16

=> /api is not remove

No problem if I remove /foo from proxy.

Forum thread : https://forum.caddyserver.com/t/proxy-without/1081/2

Most helpful comment

@SteffenDE this is a known issue, being tracked here: https://github.com/mholt/caddy/issues/1604

For now I suggest sticking with 0.9.5, or building from the master branch if you need without, unfortunately.

All 7 comments

I was able to reproduce this

Oddly it seems fixed by the code in PR #1256 for #1200 . I will investigate further

I just tested with master and it seems to work.
curl -X GET http://127.0.0.1:2015/api/bar
"GET /foo/bar HTTP/1.1" 502 16

It seems to be fixed by this commit :
https://github.com/mholt/caddy/commit/cc638c7faae4f92355ff25fc4635b54b6c989634

@sguiheux That's great. I wonder would cc638c7 fix final part of #1200 . I'll take a look

Great, I'll close this then. :)

This is happening to me after upgrading caddy to 0.10.

abc.xyz {
    root /var/www/xyz
    rewrite /staging/admin/dist/config.json /config/staging.json
    rewrite /staging/view/dist/config.json /config/staging.json
    rewrite /dist/config.json /config/staging.json
    redir /viewer/ /viewer.html
    redir /admin/ /admin.html
    redir /staging/view /staging/view/
    proxy /staging/view http://127.0.0.1:8081 {
        without /staging/view
    }
    redir /staging/admin /staging/admin/
    proxy /staging/admin http://127.0.0.1:8082 {
        without /staging/admin
    }
    redir 301 {
        if {>X-Forwarded-Proto} is http
        /  https://{host}{uri}
    }
    tls {
        dns cloudflare
    }
}

Using 0.9.5 a request to abc.zyx/staging/admin/dist/build.js hits http://127.0.0.1:8082/dist/build.js.
Using 0.10 a request to abc.zyx/staging/admin/dist/build.js hits http://127.0.0.1:8082/staging/admin/dist/build.js.

The only plugin I use is tls.dns.cloudflare.

@SteffenDE this is a known issue, being tracked here: https://github.com/mholt/caddy/issues/1604

For now I suggest sticking with 0.9.5, or building from the master branch if you need without, unfortunately.

Ok, thanks for your quick reaction!

Was this page helpful?
0 / 5 - 0 ratings