goxlr-utility icon indicating copy to clipboard operation
goxlr-utility copied to clipboard

Correctly setup CORS for the webui

Open FrostyCoolSlug opened this issue 2 years ago • 6 comments

The WebUI currently misconfigures CORS if --http-enable-cors is enabled, as it will only accept 'external' requests from localhost.

Look into providing a cleaner method of allowing users to define acceptable hosts (defaulting to localhost if none are defined).

FrostyCoolSlug avatar Mar 10 '23 21:03 FrostyCoolSlug

Does this issue still need work? I would be willing to try this out if needed.

bonsai-rishabh avatar Aug 02 '23 04:08 bonsai-rishabh

Yea, this is still needed (you can't load profiles in the UIs Dev mode when bind address is set), so I'd appreciate any help :)

FrostyCoolSlug avatar Aug 02 '23 10:08 FrostyCoolSlug

Sounds good, if you have any ideas on where to start looking for this too I would appreciate that. Feel free to assign this to me for now

bonsai-rishabh avatar Aug 02 '23 18:08 bonsai-rishabh

You'll need to start in cli.rs to add a new command line parameter which allows for a list of strings (might be best to check the clap documentation to see if there's a native way to handle that), then in main.rs, similar to the bind address, have defaults if cors is enabled but that CLI value is not set. Pass it into the HttpSettings struct, then inside the web server code adjust the CORS settings based on the values.

FrostyCoolSlug avatar Aug 02 '23 18:08 FrostyCoolSlug

Thanks for the tips, I will start reading up the codebase, also wondering if there were any particular guidelines on branches/branch names or anything I should keep in mind before I start writing anything?

bonsai-rishabh avatar Aug 02 '23 23:08 bonsai-rishabh

Nothing overt at the moment, the main key is that you'll want to make sure you're working off the latest Dev branch (dev-1.0.0 currently) and send your PR into that branch, once 1.0 is released I may tighten that up a bit, but for now it's sufficient.

FrostyCoolSlug avatar Aug 03 '23 00:08 FrostyCoolSlug