Giter VIP home page Giter VIP logo

Comments (10)

ak74fire avatar ak74fire commented on August 11, 2024 1

Sounds like same issue. I'm not familiar with FastAPI, but looks like it does handle proxy scenario:
https://fastapi.tiangolo.com/advanced/behind-a-proxy/

from sd-webui-openpose-editor.

ak74fire avatar ak74fire commented on August 11, 2024 1

The redirection could be caused by extra / at the end of the editor path:

@app.get("/openpose_editor_index/", response_class=HTMLResponse)

However in sd-webui-controlnet repo, the editor path has no ending /:

const EDITOR_PATH = '/openpose_editor_index';

I guess FastAPI would somehow issue a redirection in such situation.

Removed the extra / and now openpose editor UI can be loaded properly in RunPod.

Guess I'm too lazy to create a pull request, but it's only 2 lines of change:

index 21d7dd1..ba9b118 100644
--- a/scripts/openpose_editor.py
+++ b/scripts/openpose_editor.py
@@ -110,13 +110,13 @@ def mount_openpose_api(_: gr.Blocks, app: FastAPI):
         name="openpose_editor",
     )

-    @app.get("/openpose_editor_index/", response_class=HTMLResponse)
+    @app.get("/openpose_editor_index", response_class=HTMLResponse)
     async def index_get(request: Request):
         return templates.TemplateResponse(
             "index.html", {"request": request, "data": {}}
         )

-    @app.post("/openpose_editor_index/", response_class=HTMLResponse)
+    @app.post("/openpose_editor_index", response_class=HTMLResponse)
     async def index_post(request: Request, item: Item):
         return templates.TemplateResponse(
             "index.html", {"request": request, "data": item.dict()}

After all it has nothing to do with the path prefixes.

from sd-webui-openpose-editor.

Procyon1996 avatar Procyon1996 commented on August 11, 2024

same problem here

from sd-webui-openpose-editor.

huchenlei avatar huchenlei commented on August 11, 2024

Do you have any additional setup of an web server proxy?

The editor is setup to use relative path /openpose_editor_index.
According to the log messages, you are running WebUI locally on port 3000, but the editor is accessing port 60892.

There is nothing I can do in the repo as it is already relative path. You would need to figure out why the FastAPI route /openpose_editor_index is not served with HTTPS in your setup.

from sd-webui-openpose-editor.

ak74fire avatar ak74fire commented on August 11, 2024

The WebUI is running behind a RunPod proxy:
https://docs.runpod.io/docs/expose-ports

It maps internal URL http://127.0.0.1:3000 to external URL like https://{POD_ID}-{INTERNAL_PORT}.proxy.runpod.net:{EXTERNAL_PORT}.

However the blocked URL http://100.65.14.206:60892/openpose_editor_index/ wasn't the URL exposed by RunPod proxy, don't know how FastAPI made the IP/port. But certainly it's not truely using relative path.

Is it possible to ask FastAPI to use real relative path?

from sd-webui-openpose-editor.

huchenlei avatar huchenlei commented on August 11, 2024

This seems like a similar issue to #26.

from sd-webui-openpose-editor.

huchenlei avatar huchenlei commented on August 11, 2024

Seems like I should prefix the path with /sdapi/v1 as all other paths in WebUI have this prefix.

from sd-webui-openpose-editor.

huchenlei avatar huchenlei commented on August 11, 2024

Well. Things are pretty messy on WebUI's part. There are also prefix /internal other than sdapi/v1. You can try adding these prefixes to both this repo and controlnet repo to see if the problem is solved. I do not own a runpod instance so I cannot reproduce/test it.

Refs:

from sd-webui-openpose-editor.

ak74fire avatar ak74fire commented on August 11, 2024

Adding the prefix doesn't solve the issue.

In browser console fetch('/sdapi/v1/openpose_editor_index') got a redirection (HTTP 307) to the non-https URL:

Cf-Cache-Status: DYNAMIC
Cf-Ray: 7da0b7f85abd0495-HKG
Content-Length: 0
Date: Tue, 20 Jun 2023 02:52:57 GMT
Location: http://100.65.10.194:60775/sdapi/v1/openpose_editor_index/
Nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=r2QumR4do3Hk3E8F2dOjE5iQNnccFN9CGKtHvMU6KswHyv4le3pfLIwAQRtZBLlrhEU%2BXf9h%2FssC4vjE8UX64yX0apdY0vVRGJ5C7P70rye8fk4h39PpOQT7l5PpWycNSeyV8lRzEDwtW%2Bb7UWOAGlKchnCMQw%3D%3D"}],"group":"cf-nel","max_age":604800}
Server: cloudflare
Strict-Transport-Security: max-age=63072000; includeSubDomains

RunPod doesn't seem to produce the redirection automatically as fetch('/info') got a normal HTTP 200 response.

Any idea where in the code issued the redirection?

from sd-webui-openpose-editor.

huchenlei avatar huchenlei commented on August 11, 2024

Fixed in 84b1fe1. Thanks for tracking this down!

from sd-webui-openpose-editor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.