omaha-consulting / winget.pro

https://winget.pro
GNU Affero General Public License v3.0
90 stars 13 forks source link

winget trying to download binary from HTTP instead of HTTPS #17

Open anillo-uv opened 3 weeks ago

anillo-uv commented 3 weeks ago

Using dockers run of winget.pro. and external F5 LB as reverse proxy listening on HTTPS (443) redirecting traffic to HTTP (8000).

Everything works on clients but when trying to install any package, there is this GET:

Sending http GET request to: https://winget.mydomain.local/42f927d0-38ad-43ff-bafe-81260355ce61/packageManifests/MyProgram?Version=2.9

Then after I see this: DeliveryOptimization downloading from url: http://winget.mydomain.local/media/42f927d0-38ad-43ff-bafe-81260355ce61/MyProgram-LpqmRpf6Ms.exe

Note that winget using HTTPS, but when winget is trying to download the package, then I see the HTTP in the download url.

mherrmann commented 3 weeks ago

I suspect you need to send the X-Forwarded-Proto from F5 LB, to tell winget.Pro that it's running on https.

anillo-uv commented 2 weeks ago

Thanks, I couldnt make it work from the LB, managed to create the irule on the F5 and I see the header being sent. But it didnt work on ngnix docker side. I made it work just hardcoding this on the run/docker/nginx.conf file:

    location / {
        proxy_pass http://django;
        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 'https';
    }

hardcoding to https there, django was able to generate proper JSON responses.

Just if this could help anyone on the same situation. Regards,

mherrmann commented 2 weeks ago

Hm, I see. Is F5 LB talking to Nginx via http or https?