server {
    listen %%interface%%:%%port%% default_server;
    include /etc/nginx/includes/server_params.conf;
    include /etc/nginx/includes/proxy_params.conf;
    client_max_body_size 0;

    # Code origin : https://github.com/transmission/transmission/issues/899

    location = / {
        absolute_redirect off; # Do not add port to redirect
        return 301 ./web/;  # The slash at the end is important.
        proxy_set_header X-Forwarded-Proto $scheme; # Avoids mixed content
    }

    location / {
        proxy_pass http://127.0.0.1:9091/transmission/;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Host $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme; # Avoids mixed content

        # avoid cache
        expires -1;               # kill cache
        proxy_no_cache 1;         # don't cache it
        proxy_cache_bypass 1;     # even if cached, don't try to use it

        # Allow frames
        add_header X-Frame-Options SAMEORIGIN;
        add_header Access-Control-Allow-Origin *;
        proxy_set_header Accept-Encoding "";
    }

}
