Rest-server: unexpected http response

Hey,

I just tried to use the rest-server to backup my data between two CentOS-systems.
When I tried to connect to the server which was listening on port 8000:

"restic -r rest:http://server_ip:8000/path/to/my/repo backup /some_data"

I got this error:

"Fatal: unable to open config file: unexpected HTTP response (403): 403 AuthorizedOnly
Is there a repository at the following location?
rest:http://host:8000/path/to/my/repo"

The server-application just tells me that it listens on my port.
Moreover, I do not see any response on the server.
I ran rest-server with the command:

"rest-server --no-auth --listen ":8000" --path /tmp/restic"

When I verified that the socket listens on the correct port with netstat, it gave me this output:

"tcp6       0      0 :::8000                 :::*                    LISTEN"

As I wondered about the tcp6, I tried to check the connection by doing a telnet on this port which worked fine:

"tcp6       0      0 server_ip:8000       client_ip:any_forworded_port     ESTABLISHED"

In my opinion it’s not a network-based issue.
So either I am doing a stupid mistake or something in my environment is crappy.

Few more environment details:
-> OS: both CentOS 7 (same kernel ver.: 3.10.0-693.21.1.el7.x86_64)
-> installed both applications from source as the instructions told me
-> both hosts are virtualized on a bare-metal Hypervisor

Thanks for your help!

Hello @zoerb

It is probably something trivial, it happens.

Check these several things please:

  • /tmp/restic on the server side exists?
  • the folder has permissions, so that rest-server can write to it? (i.e. if you run rest-server as www-data user, make sure www-data user can write to it)
  • you can always use rest-server --debug on the remote side to try to debug initial setup faster (turn it off later, otherwise you’ll have too much logging)
  • finally, don’t forget restic init, restic always expects repo (not empty folder) on the other side

Don’t give up too soon, we can fix this, and then you can enjoy fast backups! :smiley:

Hey @zcalusic,

first of all thanks for your detailed and fast answer!

Unfortunately it was non of the above issues.
I checked my directories, repositories and made sure that the permissions are correct.
I used the debugging mode before but did not get any helpful logs for this case.

When I try to connect it seems that my client is instantly returning with this error.
So I still do not see anything of a connection on serverside while trying other protocols works fine.

OK, then this must be some bug introduced in the yet unreleased version. Try to compile v0.9.7 version and remove --no-auth parameter. I suspect that will be enough to get a working rest-server.

You are using CentOS which has SELinux enabled by default. Did you try to temporarily disable SELinux?
root@server:~# setenforce 0

SELinux is already completely disabled on my systems:

$ sestatus
SELinux status:                 disabled

I tried v0.9.7 without --no-auth but got the same error.

Edit: I’m pretty sure that it’s not a server issue. When I run the server-application as daemon and take a look at my incoming network traffic with nload while bombing the server with requests from restic, I do not see anything.

I know this is an ancient ticket, sorry for resurrecting.

I am too unable to get rest-server (0.9.7) working (on CentOS 8). It does seem like a bug in rest-server though.
Is this project still maintained/alive? If yes, it would be fantastic to have binaries for version 0.9.8 on GitHub too.

Edit: It only works if I run restic on the same server where “rest-server” is running (i.e. rest:http://localhost:8000 and not rest:http://10.10.10.10:8000). Changing the --listen parameter doesn’t help either (i.e. 0.0.0.0:8000).

@liv-io Hello and welcome! Yes, the rest-server project is not dead, but the next binaries that will be published are for the next version.

Regardless; If the symptoms of your current problem with rest-server are the same as initially in this forum thread, please elaborate by showing us the output and any other relevant information. If the problem is different from what’s explained initially in this forum thread, please open a new thread/post in the Getting Help category and explain the new problem there. Thanks!

Hello and many thanks for the fast answer @rawtaz!
It is not the exact same error message, hence I will open a new ticket.

Thank you!