# OpenBSD Gitea, can't push : curl 52 Empty reply from server

**URL:** <https://forum.gitea.com/t/openbsd-gitea-cant-push-curl-52-empty-reply-from-server/6950>\
**Category:** Install/Maintain/Configure\
**Created:** [March 24, 2023, 11:08pm UTC](https://forum.gitea.com/t/openbsd-gitea-cant-push-curl-52-empty-reply-from-server/6950 "2023-03-24T23:08:39Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![kvuj](https://avatars.discourse-cdn.com/v4/letter/k/ea666f/32.png) [@kvuj](https://forum.gitea.com/u/kvuj)\
**Post date:** [March 24, 2023, 11:08pm UTC](https://forum.gitea.com/t/openbsd-gitea-cant-push-curl-52-empty-reply-from-server/6950/1 "2023-03-24T23:08:39Z")

</div>

Hi,

I’ve set up Gitea (sqlite) on my OpenBSD box with https & httpd and imported some projects from gitlab. Oddly enough, when I try to push from my laptop, I get a very long timeout after trying to push and then:

Username for ‘[https://git.redacted.com](https://git.redacted.com)’:  
Password for ‘[https://tlf@git.redacted.com](https://tlf@git.redacted.com)’:  
Enumerating objects: 5, done.  
Counting objects: 100% (5/5), done.  
Delta compression using up to 8 threads  
Compressing objects: 100% (3/3), done.  
Writing objects: 100% (3/3), 321 bytes | 321.00 KiB/s, done.  
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0  
error: RPC failed; curl 52 Empty reply from server  
send-pack: unexpected disconnect while reading sideband packet  
fatal: the remote end hung up unexpectedly  
Everything up-to-date

Gitea logs don’t show anything on Debug or Error. Pf doesn’t show any blocked requests, and when attempting an edit in the browser, I get the same timeout before it cancels out…

How would I go about debugging this issue? Any ideas on the cause?

Thanks a lot for the help!

---

<div class="post-metadata">

**Author:** ![jake](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jake](https://forum.gitea.com/u/jake)\
**Post date:** [March 25, 2023, 5:42am UTC](https://forum.gitea.com/t/openbsd-gitea-cant-push-curl-52-empty-reply-from-server/6950/2 "2023-03-25T05:42:46Z")

</div>

Sounds like it may be an issue with reverse proxy or network connection. What does the httpd config look like? Is OpenBSD box on same network as your laptop?

---

<div class="post-metadata">

**Author:** ![kvuj](https://avatars.discourse-cdn.com/v4/letter/k/ea666f/32.png) [@kvuj](https://forum.gitea.com/u/kvuj)\
**Post date:** [March 28, 2023, 2:07am UTC](https://forum.gitea.com/t/openbsd-gitea-cant-push-curl-52-empty-reply-from-server/6950/3 "2023-03-28T02:07:47Z")

</div>

Sorry for the late reply!  
Yes it is on the same network, but I’ve never had trouble accessing my website through my domain name.

```auto
server "git.redacted.com" {
	listen on * tls port 443
	hsts subdomains
	tcp nodelay
	gzip-static
	tls {
		certificate "/etc/ssl/redacted.com.fullchain.pem"
		key "/etc/ssl/private/redacted.com.key"
	}
	location "/.well-known/acme-challenge/*" {
		root "/acme"
		request strip 2
	}
	# don't serve static files from cgit CGI: cgit.css and cgit.png
        location "/*" {
		fastcgi socket tcp 127.0.0.1 3000
	}
}

```

and gitea:

```auto
; ; Overwrite the automatically generated public URL. Necessary for proxies and docker.
ROOT_URL = https://git.redacted.com;
; ; when STATIC_URL_PREFIX is empty it will follow ROOT_URL
STATIC_URL_PREFIX =
; ;
; ; The address to listen on. Either a IPv4/IPv6 address or the path to a unix socket.
HTTP_ADDR = 127.0.0.1
; ;
; ; The port to listen on. Leave empty when using a unix socket.
HTTP_PORT = 3000
...
SSH_DOMAIN = git.redacted.com
ROOT_URL = https://git.redacted.com/
DISABLE_SSH = false
LFS_START_SERVER = true
OFFLINE_MODE = false

```

It seems so weird, as I said, even through the UI it won’t save any changes. Could it be missing a key package?

---

<div class="post-metadata">

**Author:** ![kvuj](https://avatars.discourse-cdn.com/v4/letter/k/ea666f/32.png) [@kvuj](https://forum.gitea.com/u/kvuj)\
**Post date:** [March 28, 2023, 2:38am UTC](https://forum.gitea.com/t/openbsd-gitea-cant-push-curl-52-empty-reply-from-server/6950/4 "2023-03-28T02:38:43Z")

</div>

Weirdly, the /var/gitea/gitea-repositories folder wasn’t created, so I made it and chowned it to \_gitea.

The default SCRIPT\_TYPE was configured to sh, but I got a messaged complaining about missing bash, so I installed it and switched the var to bash.

Still no 😕

---

<div class="post-metadata">

**Author:** ![jake](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jake](https://forum.gitea.com/u/jake)\
**Post date:** [March 28, 2023, 2:14pm UTC](https://forum.gitea.com/t/openbsd-gitea-cant-push-curl-52-empty-reply-from-server/6950/5 "2023-03-28T14:14:03Z")

</div>

Make sure `[app] PROTOCOL` is set to `fcgi`, although I assume it is because you are able to access the UI.

It looks like you are running into [this issue](https://github.com/go-gitea/gitea/issues/7747) which happens when `[app] LOCAL_ROOT_URL` is not set properly when using FastCGI. I believe it should be set to `fcgi://127.0.0.1:3000/` in your use case.

Note: the default currently listed for `APP_LOCAL_URL` in Config Cheat Sheet documentation is incorrect when `PROTOCOL` is `fcgi`, it actually defaults to `ROOT_URL`. I filed an issue to clarify this [here](https://github.com/go-gitea/gitea/issues/23769).

---

<div class="post-metadata">

**Author:** ![kvuj](https://avatars.discourse-cdn.com/v4/letter/k/ea666f/32.png) [@kvuj](https://forum.gitea.com/u/kvuj)\
**Post date:** [March 28, 2023, 2:29pm UTC](https://forum.gitea.com/t/openbsd-gitea-cant-push-curl-52-empty-reply-from-server/6950/6 "2023-03-28T14:29:44Z")

</div>

Wow, thanks a lot!

I will try and report back if it works when I get home.

---

<div class="post-metadata">

**Author:** ![kvuj](https://avatars.discourse-cdn.com/v4/letter/k/ea666f/32.png) [@kvuj](https://forum.gitea.com/u/kvuj)\
**Post date:** [March 28, 2023, 4:37pm UTC](https://forum.gitea.com/t/openbsd-gitea-cant-push-curl-52-empty-reply-from-server/6950/7 "2023-03-28T16:37:15Z")

</div>

The error seems gone 🥳

I however see a new one:

```auto
remote: Gitea: Internal Server Error
remote: Unable to contact gitea: Post "fcgi://127.0.0.1:3000/api/internal/hook/pre-receive/tlf/test1": unsupported protocol scheme "fcgi"
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.redacted.com.l.git'

```

---

<div class="post-metadata">

**Author:** ![jake](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jake](https://forum.gitea.com/u/jake)\
**Post date:** [March 29, 2023, 3:50pm UTC](https://forum.gitea.com/t/openbsd-gitea-cant-push-curl-52-empty-reply-from-server/6950/8 "2023-03-29T15:50:55Z")

</div>

Hmm, it looks like `LOCAL_ROOT_URL` is used differently than I thought. Gitea uses that config option to send internal HTTP requests to itself (and the library `net/http` used to do so does not support FCGI), but since Gitea’s listening using FCGI it can’t send them to itself, and the push fails. I can think of a few possible solutions:

1. Create an internal HTTP server on httpd just for Gitea’s operations like:

2. You could have Gitea listen on HTTP instead of FCGI and then use something like relayd, nginx, or Apache, to reverse proxy it. Then `LOCAL_ROOT_URL` would be set properly from its default and would work since it’s HTTP.

3. File an issue on GitHub to see if they will add support for `fcgi` URLs in `LOCAL_ROOT_URL`

---

<div class="post-metadata">

**Author:** ![kvuj](https://avatars.discourse-cdn.com/v4/letter/k/ea666f/32.png) [@kvuj](https://forum.gitea.com/u/kvuj)\
**Post date:** [March 29, 2023, 4:47pm UTC](https://forum.gitea.com/t/openbsd-gitea-cant-push-curl-52-empty-reply-from-server/6950/9 "2023-03-29T16:47:00Z")

</div>

Thank you **very much** for your help. It (solution 1) works very well!

If I understand correctly, `LOCAL_ROOT_URL` doesn’t understand fastcgi requests so this translates it to http to communicate with gitea, right?

It’s probably quite inefficient as a result though it seems plenty fast for my small needs. What would have been the canonical way of setting it up? Make a reverse proxy?

---

<div class="post-metadata">

**Author:** ![jake](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jake](https://forum.gitea.com/u/jake)\
**Post date:** [March 30, 2023, 3:17am UTC](https://forum.gitea.com/t/openbsd-gitea-cant-push-curl-52-empty-reply-from-server/6950/10 "2023-03-30T03:17:08Z")

</div>

> [@kvuj](#):
>
> If I understand correctly, `LOCAL_ROOT_URL` doesn’t understand fastcgi requests so this translates it to http to communicate with gitea, right?

Correct.

> [@kvuj](#):
>
> It’s probably quite inefficient as a result though it seems plenty fast for my small needs. What would have been the canonical way of setting it up? Make a reverse proxy?

Yeah, it’s not optimal. I don’t think you’ll ever run into any issues with it unless you get a ton of users. Before ever hitting that issue, I think you’d run into latency issues with using SQLite.

I’d say the most common setup is Gitea listening with HTTP via TCP or HTTP via a unix socket, and then reverse proxying Gitea using an HTTP server capable of reverse proxying those setups (nginx, relayd, Apache, others).
