Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to upload annotations on a https end point #4843

Closed
NarenZen opened this issue Aug 25, 2022 · 17 comments
Closed

Not able to upload annotations on a https end point #4843

NarenZen opened this issue Aug 25, 2022 · 17 comments
Assignees
Labels

Comments

@NarenZen
Copy link

When I upload annotations zip, I get the below error

Mixed Content: The page at 'https://cvat01.myprezent.com/tasks/4' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://cvat01.myprezent.com/api/tasks/4/annotations/1e890edc-d32f-494c-96cc-6935ce828501'. This request has been blocked; the content must be served over HTTPS.
(anonymous) @ cvat-ui.c901a1e9f80749471ab0.min.js:2
cvat-ui.c901a1e9f80749471ab0.min.js:2 Error: tus: failed to upload chunk at offset 0, caused by [object ProgressEvent], originated from request (method: PATCH, url: http://cvat01.myprezent.com/api/tasks/4/annotations/1e890edc-d32f-494c-96cc-6935ce828501, response code: n/a, response text: n/a, request id: n/a).
@bsekachev
Copy link
Member

@NarenZen

Please, provide a version of CVAT you are using and commit hash.

@zhiltsov-max zhiltsov-max added question Further information is requested ui labels Sep 6, 2022
@bsekachev
Copy link
Member

I will close the issue, please do not hesitate to reopen if you can provide the requested information

@NarenZen
Copy link
Author

NarenZen commented Oct 11, 2022 via email

@loidy
Copy link

loidy commented Oct 31, 2022

I have the same problem

@gumshoes
Copy link

Same issue with 2.2.0, unfortunately this makes CVAT difficult to host behind HTTPS.
For now I have resorted to hosting HTTPS for users that don't do any uploads and a special entry point over HTTP on a VPN for users that have to do uploads.
Anyone have a better solution?

@bsekachev
Copy link
Member

bsekachev commented Oct 31, 2022

On https://app.cvat.ai we have https protocol and everything works fine there, so, need to understand where specifics are.
So, please provide as many details as possible, including exact git hash as I asked before..

@bsekachev bsekachev reopened this Oct 31, 2022
@azhavoro
Copy link
Contributor

azhavoro commented Oct 31, 2022

@gumshoes If you have deployed CVAT behind a reverse proxy, make sure your proxy is correctly forwarding the X_FORWARDED_PROTO header, this header is required for CVAT to determine the correct protocol.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto

@loidy
Copy link

loidy commented Oct 31, 2022

@azhavoro we are using nginx reverse proxy with proxy_set_header X-Forwarded-Proto "https"; set and it still doesn't work

@azhavoro
Copy link
Contributor

@loidy Ok, please add --log.level=DEBUG to other command arguments here https://github.com/opencv/cvat/blob/develop/docker-compose.yml#L162, restart with docker compose up -d and try to upload file. Atfter dump logs with docker logs traefik > traefik.log and attach here.

@azhavoro azhavoro removed the ui label Oct 31, 2022
@gumshoes
Copy link

My setup is CVAT deployed via the Helm in git running in AWS EKS cluster with ingress provided by Traefik and an AWS NLB that does the SSL termination.
The browser error is:
Mixed content: The Page at 'https://<REDACTED>/projects?page=1' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://<REDACTED>/api/projects/backup/<UUID>'. This request has been blocked; the content must be served over HTTPS.

@nmanovic nmanovic added infra and removed question Further information is requested labels Jan 5, 2023
@jakiro2017
Copy link

Hello I found out the reason was traefik rewrite the header, if not trust the reverse proxy in front of it.

TLDR:
add "- --entryPoints.web.forwardedHeaders.trustedIPs=ip_proxy/mask" to traefik in docker-compose.yml

Ref:
traefik/traefik#5551

@jevansbio
Copy link

I have this issue when trying to upload files as well with cvat running on https.

@azhavoro
Copy link
Contributor

I believe that the cause and solution have been found, the issue can be closed
@jevansbio try this #4843 (comment)

@jevansbio
Copy link

jevansbio commented Jul 27, 2023

I had tried it, but it didn't work as in my case the request never actually hit traefik, the browser seemed to change it and block before it got anywhere. I fixed it by adding:

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />

To the header of the template.

@baudneo
Copy link

baudneo commented Oct 4, 2023

Hi, I am experiencing the same. I will try both methods and report back.

I use CloudFlare and CloudFlare tunnels to proxy to cvat.

Thanks @azhavoro for pointing me towards a fix!

@baudneo
Copy link

baudneo commented Oct 5, 2023

Adding CloudFlare ips to the traefik command worked for me.

- '--entryPoints.web.forwardedHeaders.trustedIPs=173.245.48.0/20,103.21.244.0/22,103.22.200.0/22,103.31.4.0/22,141.101.64.0/18,108.162.192.0/18,190.93.240.0/20,188.114.96.0/20,197.234.240.0/22,198.41.128.0/17,162.158.0.0/15,104.16.0.0/13,104.24.0.0/14,172.64.0.0/13,131.0.72.0/22'

@Fred-Erik
Copy link

Fred-Erik commented Apr 9, 2024

This doesn't work anymore in the newest CVAT. Turns out that if you set a flag for traefik in docker-compose.yaml it disables the other settings, which CVAT now sets using environment variables. So do apply this fix in the latest CVAT, add the following line under traefik -> environment:

TRAEFIK_ENTRYPOINTS_web_FORWARDEDHEADERS_TRUSTEDIPS: <my proxy ips>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests