Giter VIP home page Giter VIP logo

Comments (7)

liquidcarbon avatar liquidcarbon commented on May 30, 2024 1

@freddyaboulton thanks for taking a look
this line only populates the share editor blocks; the iframe was accessed through HTTPS

if hf_space_host: iframe_src = f"https://{hf_space_host}/q?query_id={query_id}"

The MixedContent problem was due to a RedirectResponse (commented out in the very end). Initially the landing page (the / route) was redirecting to a /sql endpoint. Looking through the dev tools / network panel, I could see that one of the calls during a redirect was over HTTP. I did not save the screenshot, but it was happening with this commit (I tried setting the proto header too).

In the end, I fixed it by mounting the gradio app to / and handling the absent query parameters to create a functional equivalent of a redirect.

from gradio.

freddyaboulton avatar freddyaboulton commented on May 30, 2024

Hi @LeXwDeX , can you try setting the x-forwarded-proto header to https?

from gradio.

LeXwDeX avatar LeXwDeX commented on May 30, 2024

Hi @LeXwDeX , can you try setting the x-forwarded-proto header to https?

Oh my God, After adding this header, it works.

conf snippet now:

location / {
                proxy_pass http://localhost:7860;
                proxy_set_header X-Forwarded-Proto $scheme;

from gradio.

liquidcarbon avatar liquidcarbon commented on May 30, 2024

@freddyaboulton

I have something possibly related going on...
My app in HF spaces it is complaining about insecure iframes.

index.js:1 Mixed Content: The page at 'https://huggingface.co/spaces/liquidcarbon/duckdb-fastapi-gradio' was loaded over HTTPS, but requested an insecure frame 'http://liquidcarbon-duckdb-fastapi-gradio.hf.space/sql/?alias=example1'. This request has been blocked; the content must be served over HTTPS.

It works locally, in container, and when started from
http://liquidcarbon-duckdb-fastapi-gradio.hf.space/sql/?alias=example1
but not from
https://huggingface.co/spaces/liquidcarbon/duckdb-fastapi-gradio

it's likely from my RedirectResponse to another endpoint from the landing page; I tried setting the header but it did not work.
https://huggingface.co/spaces/liquidcarbon/duckdb-fastapi-gradio/blob/main/main.py#L167

from gradio.

freddyaboulton avatar freddyaboulton commented on May 30, 2024

I think the issue is the iframe needs to be accessed over https here: https://huggingface.co/spaces/liquidcarbon/duckdb-fastapi-gradio/blob/89caffe982f0742877cc00729a925c1aa60a5ba7/main.py#L133

from gradio.

freddyaboulton avatar freddyaboulton commented on May 30, 2024

Glad you found the issue! Seems like a bug with the RedirectResponse class then?

from gradio.

liquidcarbon avatar liquidcarbon commented on May 30, 2024

I'm not sure! Starlette/FastAPI RedirectResponse doesn't concern itself with http/https directly, as far as I understand.
I think it's something with HF spaces internals. The app itself is served in an iframe, and something in there is not handling redirects properly.

If you do "view page source" on the main app page, https://huggingface.co/spaces/liquidcarbon/duckdb-fastapi-gradio

  -- <iframe src="https://liquidcarbon-duckdb-fastapi-gradio.hf.space/" aria-label="Space app" class=" space-iframe flex-grow overflow-hidden bg-white p-0 outline-none dark:bg-white" allow="accelerometer; ambient-light-sensor; autoplay; battery; camera; clipboard-read; clipboard-write; display-capture; document-domain; encrypted-media; fullscreen; geolocation; gyroscope; layout-animations; legacy-image-formats; magnetometer; microphone; midi; oversized-images; payment; picture-in-picture; publickey-credentials-get; sync-xhr; usb; vr ; wake-lock; xr-spatial-tracking" sandbox="allow-downloads allow-forms allow-modals allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-storage-access-by-user-activation" scrolling="no"></iframe>   |  

image

from gradio.

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.