New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix JS Client when app is running behind a proxy #6863
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/ee658cd0b5137ee656b20daa11837955cbcb418f/gradio-4.11.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@ee658cd0b5137ee656b20daa11837955cbcb418f#subdirectory=client/python" |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
🧡 thanks for fixing these long-standing issues @freddyaboulton! |
Does this close #4522 as well? |
time: new Date() | ||
}); | ||
post_data( | ||
`${config.root}/run${ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why the diff is so big. But basically it's just doing this change.
@@ -26,7 +26,9 @@ test("chatinterface works with streaming functions and all buttons behave as exp | |||
await expect(page.locator(".bot").nth(1)).toContainText("You typed: hi"); | |||
|
|||
await undo_button.click(); | |||
await expect.poll(async () => page.locator(".message.bot").count()).toBe(1); | |||
await expect | |||
.poll(async () => page.locator(".message.bot").count(), { timeout: 5000 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated
so I understand, what's the connection between #4522 and EventSource? |
It's possible that #4522 is fixed but we can't really test because we can't run the js client in node right now. It uses |
Does this work for old ws/wss connections as well as http/ https? I thought config.root was just the host, not the protocol as well? |
I don't think I changed the code for the ws connections so I think those should still work as the author of the issue mentions they don't have a problem when using 3.x. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Where was api_url being passed down from before? I couldn’t find it
It was being computed/passed down from |
Thanks for the review @aliabid94 |
Description
The issue is that we were constructing the URL manually but we can just use
config.root
which is the correct url hosting the gradio demo even if it's behind a proxy.Closes: #6739
Closes: #6748
I tested several demos when running behind a local nginx reverse proxy
Vanilla Hello World
Custom Components Hello World
File Explorer
Iterator + Cancel
This is the nginx.conf
🎯 PRs Should Target Issues
Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.
Not adhering to this guideline will result in the PR being closed.
Tests
PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests:
bash scripts/run_all_tests.sh
You may need to run the linters:
bash scripts/format_backend.sh
andbash scripts/format_frontend.sh