KENHI_OU
(KENHI OU)
May 13, 2020, 5:58am
1
1. Caddy version (caddy version
):
2.0.0
2. How I run Caddy:
caddy start
a. System environment:
Debian sid
b. Command:
c. Service/unit/compose file:
[Unit]
Description=Caddy HTTP/2 web server
Documentation=https://caddyserver.com/docs
After=network-online.target
Wants=network-online.target systemd-networkd-wait-online.service
[Service]
Restart=on-abnormal
Type=forking
User=www-data
Group=www-data
WorkingDirectory=/etc/caddy
ExecStart=/usr/bin/caddy start
[Install]
WantedBy=multi-user.target
d. My complete Caddyfile or JSON config:
This is my caddyfile of caddy1.
example.com {
proxy / 127.0.0.1:8080{
transparent
}
proxy /ray 127.0.0.1:10000 {
websocket
header_upstream -Origin
}
}
I tried following config file but it didn’t work.
example.com
reverse_proxy localhost:8080
reverse_proxy /ray/* localhost:10000
3. The problem I’m having:
How can I use caddy2 to do it?
“/” to :8080 but “/ray” to :10000
4. Error messages and/or full log output:
5. What I already tried:
Google Search and read document.
6. Links to relevant resources:
Can you explain what exactly you’re having trouble with? That config looks pretty correct to me. What’s not working? What behaviour are you seeing? Anything in the logs?
Also, have you see the service file we provide for Caddy v2? I think you might still be using the one you were using for Caddy v1.
# caddy.service
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
This file has been truncated. show original
KENHI_OU
(KENHI OU)
May 13, 2020, 9:01am
3
Thanks.
But I have a problem of Caddyfile, not daemon.I created it and works fine.
That’s nowhere near enough information. You need to elaborate! What’s the problem exactly?
vbakke
(Vegard Bakke)
May 13, 2020, 2:54pm
5
Are you testing with https://example.com/ray , og https://example.com/ray/something in the browser?
Where do you get an error? And what does the error say?
Vegard
dukeart
(Alex)
May 13, 2020, 3:56pm
6
You can try the same with nested directives for the host then the reverse_proxy using handle :
localhost {
file_server
handle /ray/* {
reverse_proxy localhost:10000
}
handle {
reverse_proxy localhost:8080
}
}
I think it’s a start .
Alex
system
(system)
Closed
June 12, 2020, 3:56pm
7
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.