Kopia server behind Apache proxy

Hello,

I’m trying to setup a shared kopia server behind an Apache proxy.

  • kopia started with:
    $ kopia server start --address unix:/tmp/kopia.sock
  • Apache dedicated vhost configured with:
	<IfModule proxy_module>
		RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
		ProxyPreserveHost On
		AllowEncodedSlashes NoDecode
		
		ProxyPass / "unix:/tmp/kopia.sock|http://127.0.0.1/"
		ProxyPassReverse / "unix:/tmp/kopia.sock|http://127.0.0.1/"
	</IfModule>

Client side it does not work:

$ kopia repo connect server --url https://my.vhost.example.net:443
Connecting to server 'https://my.vhost.example.net:443' as 'patpro@cassandre'...
Enter password to open repository: 

ERROR failed to open repository: unable to establish session for purpose=: error establishing session: unable to initialize session: rpc error: code = Unknown desc = unexpected HTTP status code received from server: 408 (Request Timeout); transport: received unexpected content-type "text/html; charset=iso-8859-1": EOF
ERROR error connecting to API server: unable to establish session for purpose=: error establishing session: unable to initialize session: rpc error: code = Unknown desc = unexpected HTTP status code received from server: 408 (Request Timeout); transport: received unexpected content-type "text/html; charset=iso-8859-1": EOF

And server-side:
[Sat Apr 20 22:52:21.857359 2024] [proxy:error] [pid 38739:tid 35112581888] (70007)The timeout specified has expired: [remote A.B.C.D:65176] AH01095: prefetch request body failed to /tmp/kopia.sock:0 (127.0.0.1) from A.B.C.D ()

Any hint/help appreciated!

thanks

Another attempt with this, failed too, but with a different error:

	<IfModule proxy_module>
		ProxyPreserveHost On
		ProxyPass / unix:/tmp/kopia.sock|h2://my.vhost.example.net:443/
		ProxyPassReverse / unix:/tmp/kopia.sock|h2://my.vhost.example.net:443/
	</IfModule>
$ kopia repository connect server --url https://my.vhost.example.net:443
Connecting to server 'https://my.vhost.example.net:443' as 'patpro@cassandre'...
Enter password to open repository: 

ERROR failed to open repository: unable to establish session for purpose=: error establishing session: unable to initialize session: rpc error: code = Unavailable desc = unexpected HTTP status code received from server: 503 (Service Unavailable); transport: received unexpected content-type "text/html; charset=iso-8859-1": EOF
ERROR error connecting to API server: unable to establish session for purpose=: error establishing session: unable to initialize session: rpc error: code = Unavailable desc = unexpected HTTP status code received from server: 503 (Service Unavailable); transport: received unexpected content-type "text/html; charset=iso-8859-1": EOF

server-side, error is:

[Sun Apr 21 17:04:57.951186 2024] [proxy:error] [pid 65499:tid 35581841408] (13)Permission denied: AH02454: H2: attempt to connect to Unix domain socket /tmp/kopia.sock (my.vhost.example.net:443) failed

Hello @p4tpr0l, did you make it working?

Nope, and I’ve totally given up on Kopia.

1 Like