Label-studio: Hosts with base URL's do not work with label-studio

Created on 26 Mar 2021  路  4Comments  路  Source: heartexlabs/label-studio

Describe the bug
When using the option --host argument with a base URL, for example the one shown in the label-studio argument help --host "http://ls.domain.com/subdomain/", href's with absolute paths (those starting with"/") break and make label-studio unusable. URL's should all be changed to relative paths when using base href html tag (either remove leading "/" or add start with "./").

This issue keeps cropping up in new releases and has been discussed before in issues https://github.com/heartexlabs/label-studio/issues/358 and https://github.com/heartexlabs/label-studio/issues/507

Locations

To Reproduce
Steps to reproduce the behavior (it would be great if this could be added as a test case):

  1. docker run -it -p 8080:8080 heartexlabs/label-studio:latest label-studio --host "http://ls.domain.com/subdomain/"
  2. Notice how <a href="/user/signup">Sign up</a> resolves to http://ls.domain.com/user/signup, but it should resolve to http://ls.domain.com/subdomain/user/signup. This would be corrected with <a href="./user/signup">Sign up</a> when <base href="http://ls.domain.com/subdomain/"> is in the <head> html tag.
  3. To simulate a subdomain environment, it may be useful to add the line 127.0.0.1 ls.domain.com to /etc/hosts (have not tested this)
Deployment bug

Most helpful comment

@laynr We are releasing 1.0.2 version today, these problems must be fixed there. Or you can try master branch right now.

All 4 comments

@nicholasrq check this please in the frontend part.

@laynr Could you check pip install label-studio==1.0.1rc1 please? I hope it's fixed there.

@nicholasrq / @makseq

  1. There are still some web page errors in the 1.0.1 release. For example the css and images are still NOT using relative paths.

For example this line of code:
https://github.com/heartexlabs/label-studio/blob/e50c16f096a7383147d2289f324cf28990336066/label_studio/users/templates/users/user_signup.html#L9
resolved to <link rel="stylesheet" href="/static/css/login.<some number>.css"/> when viewing the source of the rendered webpage. If it resolved to <link rel="stylesheet" href="./static/css/login.<some number>.css"/> I believe it would work.

Similarly this line of code:
https://github.com/heartexlabs/label-studio/blob/e50c16f096a7383147d2289f324cf28990336066/label_studio/users/templates/users/user_signup.html#L26
resolved to <img src="/static/images/opossum_hanging.<some number>..svg when viewing the source of the rendered webpage. If it resolved to img src="./static/images/opossum_hanging.<some number>..svg I believe it would work.

  1. However, lines of code that were updated with { settings.HOSTNAME }}/ like the following worked!!

https://github.com/heartexlabs/label-studio/blob/e50c16f096a7383147d2289f324cf28990336066/label_studio/users/templates/users/user_signup.html#L29
https://github.com/heartexlabs/label-studio/blob/e50c16f096a7383147d2289f324cf28990336066/label_studio/users/templates/users/user_signup.html#L30

  1. Worrying after creating an account, and clicking the "Log in" button the projects page is blank/all white (not rendered at all, but view source does show html) . All the href, src, and base href appear correct. Maybe the java script files need to be changed (I don't know)?

@laynr We are releasing 1.0.2 version today, these problems must be fixed there. Or you can try master branch right now.

Was this page helpful?
0 / 5 - 0 ratings