title: gitea using a normal user and https
body: <p>I am trying to setup gitea to use https with a certificate I got from letsencrypt running the service as a <strong>normal user</strong>.</p>
  
  <p>I already got it working with http on port 80 with a normal user <code>git</code> and redirecting port 80 to port 3000 using iptables.</p>
  
  <p>Also I already got it working with https on port 3000 redirecting to port 3080.</p>
  
  <p>But I can't figure out how to configure it (maybe along with iptables) so that requests to port 80 redirect to the appropiate port (3000? 3080?).</p>
  
  <p>I redirect the port 80 to port 3000 using this iptables command as root:</p>
  
  <p><code># iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 3000</code></p>
  
  <p>And this is the relevant part of my configuration for HTTP</p>
  
  <pre><code>RUN_USER         = git
  
  LOCAL_ROOT_URL   = http://localhost:3000/
  DOMAIN           = example
  HTTP_PORT        = 80
  ROOT_URL         = http://example.com
  </code></pre>
  
  <p>This is my configuration for HTTP on port 3000 redirecting to port 3080</p>
  
  <pre><code>RUN_USER            = git
  
  PROTOCOL            = https
  LOCAL_ROOT_URL      = https://localhost:3000/
  DOMAIN              = example.com
  HTTP_PORT           = 3000
  REDIRECT_OTHER_PORT = true
  PORT_TO_REDIRECT    = 3080
  ROOT_URL            = https://example.com
  CERT_FILE           = /etc/letsencrypt/live/example.com/fullchain.pem
  KEY_FILE            = /etc/letsencrypt/live/example.com/privkey.pem
  </code></pre>
  
  <p>With this configuration I can visit <code>https://example.com:3000</code> and it works fine but if I visit <code>https://example.com:3080</code> I get an <code>Secure Connection Failed</code> with <code>Error code: SSL_ERROR_RX_RECORD_TOO_LONG</code>.</p>
  
  <p>I tried to redirect the port 80 to port 3080 using iptables but it didn't work.</p>
  
  <p>Can you help me set it up so I can run the service as normal user in port 80 so that people can visit it at <code>https://example.com</code> ? (maybe using iptables as root beforehand to redirect some ports) Thanks in advance</p>