-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add CORS functionality to Locust #1793
Conversation
Add Flask-Cors >= 3.0.10 as a dependency, add enable_cors argument to WebUI, add --enable-cors command line argument to argument_parser
Hi! is there any down side to having this always enabled (one less command line option to worry about)? |
Hey! The only downside is if someone happens to guess the IP address Locust is running on (very unlikely) they would be able to spy on and control your test unless you also had Basic Auth turned on. Though now that I'm thinking about it, perhaps that's not the biggest issue in the world. Thoughts? |
Isnt that already the case? (if they just open the URL) |
Yup, you're absolutely correct; I had forgotten about that lol I can push some changes later today to make it always on. Also, were the failing tests caused by me somehow? The line below might suggest otherwise but I have no clue honestly
|
👍 The error is that your code is not formatted correctly. Install and run |
Ah, so it was my fault after all lol Okay, I'll get that fixed up as well and push an update later today! |
Okay, a bit late but the changes have been made.
|
Cool stuff! Can you try it out with flask 2 so we know it is compatible for our coming upgrade? |
After replicating the changes found in #1764, everything continues to work as expected! |
Thx! |
No problem! As for the coming upgrade, is there any rough estimate on the release date? If not, no worries |
Not really, sorry |
I'm in the process of integrating Locust with other services at my work and we recently ran into CORS issues when trying to access the Locust API. We had circumvented it initially by using a CORS proxy server but I've since come back and updated Locust to be able to handle CORS internally using Flask-Cors. Figured it was a useful enough feature to share!
This is my first PR here so I'm not 100% sure if everything was done properly; happy to receive any and all feedback!
Changes:
Flask-Cors >= 3.0.10
as a dependencyenable_cors
argument to WebUI class--enable-cors
command line argument toargument_parser.py