# iptables -t nat -A PREROUTING \
#   -i <incoming network interface> \
#   -p tcp --dport GERBERA_PORT \
#   --src <client's IP> \
#   --dst GERBERA_IP> \
#   -j REDIRECT --to-port NGINX_PORT

server {
  listen GERBERA_IP:NGINX_PORT;

  location / {
    proxy_pass              http://GERBERA_IP:GERBERA_PORT/;

    proxy_set_header        Host $host;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        X-Forwarded-Proto $scheme;
    proxy_set_header        User-Agent "imperial DABMAN i250 (proxied by nginx)"; # Used for client filtering in Gerbera

    proxy_http_version 1.1; # This is important :)
  }
}

#  <clients enabled="yes">
#    <client userAgent="imperial DABMAN i250" flags="TRANSCODING1" />
#    <!-- Identify the requests by User-Agent string and flag them accordingly -->
#  </clients>
#  <transcoding enabled="yes">
#    <mimetype-profile-mappings>
#      <transcode mimetype="audio/ogg" client-flags="TRANSCODING1" using="profile"/>
#    </mimetype-profile-mappings>
#    <profiles>
#      <profile name="profile" enabled="yes" type="external">
#        <mimetype>audio/mpeg</mimetype>
#        <dlna-profile>MP3</dlna-profile>
#        <accept-url>no</accept-url>
#        <first-resource>yes</first-resource>
#        <accept-ogg-theora>no</accept-ogg-theora>
#        <agent command="<path to shell script that does the actual transcoding>" arguments="%in %out" />
#        <buffer size="1048576" chunk-size="131072" fill-size="262144"/>
#      </profile>
#    </profiles>
#  </transcoding>