label-studio icon indicating copy to clipboard operation
label-studio copied to clipboard

DOMAIN_FROM_REQUEST=True is maybe inconsistent with HOSTNAME handling

Open curlup opened this issue 1 year ago • 4 comments

is it me or is this code https://github.com/HumanSignal/label-studio/blob/develop/label_studio/core/settings/base.py#L111-112

clashes with this code just couple lines above https://github.com/HumanSignal/label-studio/blob/develop/label_studio/core/settings/base.py#L88-93 ?

My reading is that if DOMAIN_FROM_REQUEST=True by the time line 111 get's executed, the line 92 or else clause on line 93 guarantee that 112 will raise an error.

So basically there's no configuration with DOMAIN_FROM_REQUEST=True that will not raise on L112.

curlup avatar Apr 09 '24 18:04 curlup

Facing this as well, lines 107:114 should be moved above line 87

oreilles avatar May 06 '24 06:05 oreilles

I guess somehow it doesn't make sense to the maintainers?

curlup avatar Jun 10 '24 18:06 curlup

Could you please describe more details what settings are you trying to use? Have you tried to use something like LABEL_STUDIO_HOST=http://domain/subpath instead of LABEL_STUDIO_HOST=/subpath?

makseq avatar Jun 14 '24 17:06 makseq

If you set LABEL_STUDIO_HOST=http://domain/subpath and DOMAIN_FROM_REQUEST=True, the result will be an exception because:

https://github.com/HumanSignal/label-studio/blob/39a92aef950cd2c6a8ac92a39b17b7e1716b52f9/label_studio/core/settings/base.py#L109-L112

If you set LABEL_STUDIO_HOST=/subpath and DOMAIN_FROM_REQUEST=True, it won't work either cause the variable LABEL_STUDIO_HOST will be reset to an empty string:

https://github.com/HumanSignal/label-studio/blob/39a92aef950cd2c6a8ac92a39b17b7e1716b52f9/label_studio/core/settings/base.py#L87-L92

I made a PR to address this but it has been closed: https://github.com/HumanSignal/label-studio/pull/5874

oreilles avatar Jun 15 '24 10:06 oreilles