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

Fixed issue with cvat running in HTTP mode behind a HTTPS reverse proxy #7313

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

cargoculttech
Copy link

  • Check if HTTP_ORIGIN exists in the request.META, if it does, use the same http scheme for the TUS location uri. If not exist, use Django's build_absolute_uri() for the TUS location uri.

Issue: #7288

Motivation and context

Fixed the problem where TUS resumable upload feature does not work when CVAT is setup to run in HTTP only, but put behind a HTTPs proxy.
Scenario: Client --> HTTPS reverse proxy --> HTTP Cvat server
Originally, CVAT would return HTTP location for tus resumable, but since client is requesting CVAT through a HTTPS proxy, CVAT should also return a HTTPS location for TUS resumable.
The change allows CVAT to recognize that it's behind a HTTPS reverse proxy, and return the HTTP scheme accordingly. This
change also works if Client --> HTTP reverse proxy --> HTTPS Cvat server.

This change is required because it makes CVAT easier to be hosted behind a reverse proxy.
Screenshot from 2024-01-04 17-02-061

How has this been tested?

I set up a public nginx proxy manager on https://dev.cvat.mycompany.com, and it proxies to http://192.168.1.123:8080 (my cvat machine). Features such as import dataset didn't work because it uses TUS Resumable, which was returning the wrong HTTP scheme. After the change, the feature works when the proxy server and cvat runs in different HTTP scheme.

Checklist

If an item isn't applicable for some reason, then explicitly strikethrough the whole
line. If you don't do that, GitHub will show incorrect progress for the pull request.
If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

  • I submit my changes into the develop branch
    - [ ] I have created a changelog fragment
    - [ ] I have updated the documentation accordingly
    - [ ] I have added tests to cover my changes
  • I have linked related issues (see GitHub docs)
    - [ ] I have increased versions of npm packages if it is necessary
    (cvat-canvas,
    cvat-core,
    cvat-data and
    cvat-ui)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

- Check if HTTP_ORIGIN exists in the request.META, if it does, use the same http scheme for the TUS location uri. If not exist, use Django's build_absolute_uri() for the TUS location uri.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants