location / {
    index index.html;
    root __INSTALL_DIR__/www/;
}

location /webirc/ {
    # Forward incoming requests to local webircgateway socket
    proxy_pass http://127.0.0.1:__PORT__/webirc/;

    # Set http version and headers
    proxy_http_version 1.1;
    proxy_redirect default;

    # Add X-Forwarded-* headers
    proxy_set_header X-Forwarded-Host   $host;
    proxy_set_header X-Forwarded-Proto  $scheme;
    proxy_set_header X-Real-IP          $remote_addr;
    proxy_set_header X-Forwarded-For    $remote_addr;

    # Allow upgrades to websockets
    proxy_set_header Upgrade     $http_upgrade;
    proxy_set_header Connection  "upgrade";
}
