stable-diffusion-webui-forge icon indicating copy to clipboard operation
stable-diffusion-webui-forge copied to clipboard

Setting `--data-dir` leads to 403 trying to load files from `<sd-folder>/javascript`

Open GabeDuarteM opened this issue 1 year ago • 3 comments
trafficstars

If you set export COMMANDLINE_ARGS="--cuda-malloc --xformers --listen --data-dir /some/other/folder", when you open the UI, it gets completely broken:

image

If I remove the --data-dir argument, then it loads fine.

Checking the browser logs, I see a bunch of 403 errors trying to load I assume files from the <sd-folder>/javascript folder:

image

I tried copying the javascript folder into the data-dir folder I have, but it also doesn't fix it.

On Automatic1111 this setting works fine with the same dir. Also, those javascript files seem to get cached, so when you change the --data-dir flag you need to do a hard reload with ctrl shift r for it to happen.

Is this flag unsupported? or its just a bug? Or maybe I'm missing something else?

I'm running this on linux, if thats relevant

GabeDuarteM avatar Aug 17 '24 05:08 GabeDuarteM

This is one of the breaking change in gradio 4

Since the working directory is now not served by default, if you reference local files within your CSS or in a gr.HTML component using the /file= route, you will need to explicitly allow access to those files (or their parent directories) using the allowed_paths parameter in launch()

https://github.com/gradio-app/gradio/issues/6339

TL;DR

For user

Add this to the arguments --gradio-allowed-path "."

For forge dev

demo.launch(allowed_paths=["."])

However, it is best to clearly list all the files/directories that need to be served.

jim60105 avatar Aug 22 '24 10:08 jim60105

Can confirm, adding --gradio-allowed-path "." to the COMMANDLINE_ARGS list addresses the issue

GabeDuarteM avatar Aug 22 '24 10:08 GabeDuarteM

This is one of the breaking change in gradio 4

Since the working directory is now not served by default, if you reference local files within your CSS or in a gr.HTML component using the /file= route, you will need to explicitly allow access to those files (or their parent directories) using the allowed_paths parameter in launch()

gradio-app/gradio#6339

TL;DR

For user

Add this to the arguments --gradio-allowed-path "."

For forge dev

demo.launch(allowed_paths=["."])

However, it is best to clearly list all the files/directories that need to be served.

Thank you for this! It was driving me crazy why I had no problems with A1111 and reForge, but Forge always just silently did nothing.

WeirdFan avatar Jun 25 '25 23:06 WeirdFan