Describe the bug
Can't open uploaded file from host
To Reproduce
Steps to reproduce the behavior:
label-studio start {project}There was an issue loading URL from $csv value. Most likely that's because static server has wide-open CORS. Read more on that here.
Also check that:
URL is valid
Network is reachable
URL: http://localhost:8080/data/upload/23a6a3ba2a65dde741c97818c0f586e2-file_1.csv
*Environment *
My config for project
`
<TimeSeriesLabels name="label" toName="ts">
<Label value="-1" background="red"></Label>
<Label value="+1" background="green"></Label>
</TimeSeriesLabels>
<TimeSeries
name="ts"
valueType="url"
timeColumn="tradedate"
value="$csv"
sep=","
timeFormat="%Y-%m-%d"
timeDisplayFormat="%Y-%m-%d"
overviewChannels="waprice"
>
<Channel
column="waprice"
strokeColor="#1f77b4">
</Channel>
<Channel
column="val"
strokeColor="#ff7f0e">
</Channel>
</TimeSeries>
`
@tibhar940 What if you open csv link directly?
http://localhost:8080/data/upload/23a6a3ba2a65dde741c97818c0f586e2-file_1csv
I see there is no dot before csv in this URL, it's a little bit strange..
@makseq Sorry, my fault. Fixed.
Does it resolve this issue?
@makseq No, it was a problem then I write an example.
Ok. So, what if you open csv link directly?
http://localhost:8080/data/upload/23a6a3ba2a65dde741c97818c0f586e2-file_1.csv
@makseq I also add my config file to issue
@makseq I can open csv directly from localhost, but can't from another. Host http://{SERVER}:8080 reachable, but I got error with this file http://localhost:8080/data/upload/23a6a3ba2a65dde741c97818c0f586e2-file_1.csv . But (I guess) it should open http://{SERVER}:8080/data/upload/23a6a3ba2a65dde741c97818c0f586e2-file_1.csv instead.
I tried to open http://{SERVER}:8080/data/upload/23a6a3ba2a65dde741c97818c0f586e2-file_1.csv directly and it works
Try to run LS with --host {SERVER}. Will it fix this issue?
@makseq No, the same error
Is {SERVER} an ip address?
@makseq Yes.
I'll check it and will be back.
I started server on IP_1, and try to open from another machine (IP_2)
I think the solution for right now is to open your_project/tasks.json and change all paths like
http://localhost:8080/data/upload/23a6a3ba2a65dde741c97818c0f586e2-file_1.csv
to
http://{SERVER}:8080/data/upload/23a6a3ba2a65dde741c97818c0f586e2-file_1.csv
Plus you need to use --host={SERVER} in label-studio start your_project --host={SERVER}.
I think you used --host after the file import and path was formed as http://localhost:8080/data/... instead of http://{SERVER}:8080/data/....
@makseq Is it necessary to use quotes in this command? label-studio start your_project --host='{SERVER}'?
I think the solution for right now is to open your_project/tasks.json and change all paths like
http://localhost:8080/data/upload/23a6a3ba2a65dde741c97818c0f586e2-file_1.csv
tohttp://{SERVER}:8080/data/upload/23a6a3ba2a65dde741c97818c0f586e2-file_1.csv
I replaced and it works! But i think this is a bug.
Do you use --host option now? And have you check a new import for file?
@makseq Yes, used. No, haven't. I'll check now.
@makseq
Well.
Well! So, have your issue been fixed?
@makseq Thank you!
Is it possible to allow CORS when using label studio? I am having the same issue because my tasks contains external URLs. This is the error that I get:

If I click on the Read more on that here link the suggested solution is to use ngnix as a proxy server to bypass CORS. Wouldn't be possible to just allow CORS in the blueprint.py, something like this (maybe flag guarded somehow):
@blueprint.after_request
def after_request(response):
header = response.headers
header['Access-Control-Allow-Origin'] = '*'
return response
I'd prefer to avoid having to install nginx to address this issue.
Where are the files, which the links lead to, stored? The CORS is the problem of the external server where the files are stored. It's not LS problem..
Oh yes! sorry you are right. My bad. I had to configure the other server to return CORS headers. Now everything works fine. Please ignore my previous comment.