# Troubleshooting Forgejo "Internal Server Error" on Coolify

---

<div style="display: flex; justify-content: center;">
  <a href="https://www.aihonestybadge.com" target="_blank" rel="noopener"><img src="https://www.aihonestybadge.com/badges/ai-generated.svg" alt="AI Generated Badge" style="max-width: 190px; height: auto;" /></a>
</div>  

---

**Date:** 22 July 2026  
**Platform:** Coolify  
**Application:** Forgejo  
**Database:** MariaDB  

## 🔴 Symptom
After deploying Forgejo on Coolify, accessing the Web UI results in a `500 Internal Server Error`.

## 🔍 Log Analysis
Reviewing the container logs revealed the following patterns:
1. **MariaDB:** Initialized successfully and ready for connections on port `3306`.
2. **Forgejo Web:** Successfully started the web server on internal port `3000` (`Listen: http://0.0.0.0:3000`).
3. **Forgejo SSH:** Successfully started the internal SSH server on port `22`.
4. **Error Signatures:** The Forgejo logs repeatedly showed the following error when attempting to load the web page:
   ```text
   banner exchange: Connection from 10.0.11.4 port 44134: invalid format
   ```

## 🧠 Root Cause
The "banner exchange: invalid format" error is a classic signature of HTTP/HTTPS traffic being accidentally routed to an SSH port. 

Coolify's internal reverse proxy was mistakenly directing incoming web traffic (from the domain `https://trowel.obulou.org`) to Forgejo's SSH port (`22`) instead of its web server port (`3000`). Because the SSH server cannot process HTTP web requests, it rejects the connection, prompting the reverse proxy to return an "Internal Server Error" to the browser.

## ✅ Resolution
The port routing mapping in Coolify needs to be explicitly defined.

1. Open the Coolify dashboard and navigate to the **Forgejo** resource/project.
2. Go to the **General** or **Configuration** tab.
3. Locate the **Domains** field.
4. Append the internal web port to the domain URL to instruct the reverse proxy where to route the traffic.
   * *Change:* `https://trowel.obulou.org`
   * *To:* `https://trowel.obulou.org:3000`
   * *(Note: This only affects internal routing; the public site remains accessible via standard HTTPS without typing the port).*
5. Check the **Ports Exposes** field. Ensure that `3000` is present. If multiple ports are listed, ensure `3000` is the primary/first port listed, as Coolify's proxy defaults to the first exposed port if it is not explicitly declared in the Domains field.
6. **Save** and **Deploy/Restart** the container.

## 🏷️ Tags
`#coolify` `#forgejo` `#troubleshooting` `#500-error` `#reverse-proxy` `#port-mapping` `#devops`