1. Caddy version:
v2.6.4 h1:2hwYqiRwk1tf3VruhMpLcYTg+11fCdr8S3jhNAdnPy8=
2. How I installed and ran Caddy:
I follow this links to install caddy
a. System environment:
Operating System: Debian 11
Kernel: 5.4.128-1-pve
Architecture: x86_64
b. Command:
caddy start
caddy stop
c. My complete Caddy config:
:80 {
reverse_proxy localhost:3002
handle_path /v1/api/* {
root * /var/www/html/api/public
file_server
encode zstd gzip
php_fastcgi unix//run/php/php8.2-fpm.sock
}
handle_path /v1/* {
root * /var/www/html/v1/prod
file_server
}
handle_path /admin/* {
root * /var/www/html/admin
file_server
}
handle_path /lot1/* {
reverse_proxy localhost:9001
}
handle_path /lot2/* {
reverse_proxy localhost:9002
}
handle_path /ws/* {
reverse_proxy localhost:3005
file_server
# this a websocket apps
}
handle_path /ps/* {
root * /var/www/html/some_php_scripts
encode zstd gzip
php_fastcgi unix//run/php/php8.2-fpm.sock {
try_files {path} {path}/index.php =404
}
file_server
}
handle_path /backend/* {
reverse_proxy ip:8080
}
log {
output file /var/log/caddy/access.log {
roll_size 3MiB
roll_keep 5
roll_keep_for 48h
}
format console
}
}
3. The problem I’m having:
I’m new to Caddy. I have Java, NodeJS, PHP application & a WebSocket running on a domain. A NodeJS application running on port:80 is working fine. but the resources of all the other applications are redirected with 302 to port:80 NodeJS application. like as you can see on my caddy config I have the applications running on ports 9001, 9002, 3002, 3005. Here port 9001 and 9002 is using the resources of the port 3002 application and WebSocket is going to example.com/socket.io
instead of example.com/ws/socket.io
. Is there a way to solve this by Caddy? if yes. Help me write the config.