This post is created 3 years ago, the content may be outdated.
Goal
Setup a WebDAV file server and a local webpage with Caddy, then expose the services to the Internet using FRP.
Localhost
Caddy
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| http://:80/webdav/ { log stdout basicauth / Apocalypse 4W9yaFeC8szfsJGF basicauth / Zaychik aKQG96BjmQ9Vq8AB webdav / { scope /mnt/share/ Apocalypse: modify true Zaychik: modify false } }
http://:80/web_dev/ { log stdout basicauth / Kaslana 9EuCXSvwdCnsPS3Q proxy / localhost:19999 { } }
|
FRP Client
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| [common] server_addr = foo.com server_port = 7000 login_fail_exit = true protocol = tcp privilege_token = mZBhe5CaxjxTGdNL
[Web] type = tcp local_ip = 127.0.0.1 local_port = 80 remote_port = 8080 use_encryption = true use_compression = true
|
Proxy Server
Caddy
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| http://foo.com:80, https://foo.com:443 { log stdout redir 301 { if {scheme} is http / https://{host}{uri} } tls /path_to_cert/foo.com/fullchain /path_to_cert/foo.com/key root /wwwroot/ index index.html
proxy /frp/ http://127.0.0.1:8080 { without /frp transparent } }
|
FRP Server
1 2 3 4 5 6 7 8 9
| [common] bind_port = 7000 kcp_bind_port = 7000 bind_udp_port = 7001 dashboard_port = 7500 dashboard_user = Rossweisse dashboard_pwd = tNyexbhGKY8pzHzU privilege_token = mZBhe5CaxjxTGdNL
|
Tips
To add a WebDAV network location in Windows, the directory format must be “https://foo.com/frp/webdav/sub_dir". The trailing slash at the end must NOT be added, and at least one sub directory should be specified. “https://foo.com/frp/webdav/" and “https://foo.com/frp/webdav" will NOT work. Curse you stupid Windows!