Issue with HTTP to HTTPS Protocol Mismatch Using Swag Container Reverse Proxy

I use a Swag container reverse proxy to map my self-hosted services to the public internet. However, I found that when using VSCode to pull repository content, the authorization page returns an incorrect link protocol to the browser. It converts the HTTP protocol to HTTPS. What is causing this issue?

Here is the Gitea Nginx configuration file:

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name git.mydomain.com;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    location / {
        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app 192.168.1.139;
        set $upstream_port 3000;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;
    }

    location ~ (/gitea)?/info/lfs {
        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app 192.168.1.139;
        set $upstream_port 3000;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;
    }
}

Did you set [server] ROOT_URL in your app.ini? Reverse Proxies | Gitea Documentation

See Reverse proxy (nginx) setup question - #7 by Reformed6611 as this poster also had issues with Swag.

Thank you for your reply. I found where the problem is:

proxy_redirect http:// $scheme://;

It’s on line 13 of “proxy.conf”.