woubuc
(Wouter)
April 23, 2017, 1:15pm
1
I’ve got a proxy directive on the path /api
that goes to a node.js app, but I want to remove the /api part from the url. So I added the ‘without’ option to my Caddyfile as documented in https://caddyserver.com/docs/proxy but my app still receives the full url including /api
.
My Caddyfile:
checklist.dev:80 {
redir / https://checklist.dev{path}
}
checklist.dev:443 {
tls self_signed
header / -server
proxy /api http://localhost:8001 {
without /api
}
proxy / http://localhost:8000
}
My node.js API server routes at localhost:8001
app.use('/api/v1/checks', function(req, res) {
console.log('1');
res.send('1');
});
app.use('/v1/checks', function(req, res) {
console.log('2');
res.send('2');
});
A request to https://checklist.dev/api/v1/checks
will return 1, when instead it should come back 2 (since it should match the route without the /api
).
Am I missing something in my Caddyfile or is this a bug?
juhani
(Juhani Naskali)
April 23, 2017, 2:51pm
2
There’s a bug with without in 0.10
https://github.com/mholt/caddy/issues/1604
I had the same problem and downgraded back to 0.9.5 until the fix gets released.
matt
(Matt Holt)
April 23, 2017, 2:52pm
3
Hi @woubuc , have you checked the issues? https://github.com/mholt/caddy/issues/1604 - is this different?
woubuc
(Wouter)
April 23, 2017, 4:09pm
4
Oops, I didn’t check Github. Seems to be the same issue @matt , I’ll see if I can use the previous version for now.
Is there a way to target a specific version of Caddy when installing through getcaddy.com ?
matt
(Matt Holt)
April 23, 2017, 4:11pm
5
Sounds good. Just wanted to double check!
And no, not at this point. Maybe in the future, but I’m hesitant to make it easier to distribute old versions of the software.
woubuc
(Wouter)
April 23, 2017, 4:20pm
6
I agree it should come with a warning, but I think it should be possible for situations like this to easily go back to a previous version for a while until a bug in the new version is fixed.
lbguilherme
(Guilherme Bernal)
April 23, 2017, 4:25pm
7
Btw, when is a bugfix release coming, to solve this?
system
(system)
Closed
July 22, 2017, 4:35pm
8
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.