Feature Request: Pathname-based Proxy Address Handling in ComfyUI
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 153
Description
### Feature Idea
When running ComfyUI within a container, the presence of an additional pathname in the proxy address (e.g., https://127.0.0.1:8188/proxy/master-0/) leads to issues with loading static resources from the /assets directory. This is due to the static asset paths being relative to the root of the proxy address, which is not correctly accounted for when the request is made.
### Existing Solutions
To address this issue, a modification has been made to the index-D8Zp4vRl.js file within the /ComfyUI/web/assets directory. The code snippet below demonstrates how the path is now dynamically adjusted to accommodate the proxy address:
``` javascript
//const __vite__mapDeps = (i, m = __vite__mapDeps, d = (m.f || (m.f = ["assets/index--0nRVkuV.js", "assets/index-DjWyclij.css", "assets/userSelection-CH4RQEqW.js", "assets/userSelection-BGzn1LuN.css"]))) => i.map(i => d[i]);
const _endpoint = location.pathname.substr(1)
if (_endpoint==='/')
_endpoint=''
const __vite__mapDeps = (i, m = __vite__mapDeps, d = (m.f || (m.f = [`${_endpoint}assets/index--0nRVkuV.js`, `${_endpoint}assets/index-DjWyclij.css`, `${_endpoint}assets/userSelection-CH4RQEqW.js`, `${_endpoint}assets/userSelection-BGzn1LuN.css`]))) => i.map(i => d[i]);
```
Additionally, the index.html file has been updated to reflect the new path handling:
```html
```
ComfyUi Run successfully,
Let me know if there is a better way for the container pathname to handle assets, ensuring that the agent's pathname can load resources, I would be grateful
### Other
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.