[DOCS]: fail to call API to add Chunks to a Document in local Dify #277

Closed
opened 2026-02-16 05:19:43 -05:00 by yindo · 3 comments
Owner

Originally created by @ThomosShen on GitHub (Nov 26, 2025).

Type of Documentation Change

Error/Typo fix

Documentation Page URL or Path

No response

Current Content

Image Image Image

Suggested Changes

As shown above, I tried to use online tools in dify to call call api to add Chunks to a Document in my local Dify, but it failed no matter the api base url is http://160.1.39.31:1003/v1 or http://localhost:1003/v1. And i also tried to add chunk in my dify and it works, is anything wrong in api base url? (FYI, I update the port number to 1003)

Reason for Change

No response

Code of Conduct

  • I agree to follow Dify's documentation contribution guidelines
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.
Originally created by @ThomosShen on GitHub (Nov 26, 2025). ### Type of Documentation Change Error/Typo fix ### Documentation Page URL or Path _No response_ ### Current Content <img width="902" height="606" alt="Image" src="https://github.com/user-attachments/assets/985f3fa6-e59b-4469-a80a-e18515ef362c" /> <img width="1213" height="856" alt="Image" src="https://github.com/user-attachments/assets/4016b24d-2417-4983-9eec-70c9fd0ebdc6" /> <img width="1137" height="799" alt="Image" src="https://github.com/user-attachments/assets/0fc51c1a-2b50-4799-867d-a763bf707f30" /> ### Suggested Changes As shown above, I tried to use online tools in dify to call call api to add Chunks to a Document in my local Dify, but it failed no matter the api base url is http://160.1.39.31:1003/v1 or http://localhost:1003/v1. And i also tried to add chunk in my dify and it works, is anything wrong in api base url? (FYI, I update the port number to 1003) ### Reason for Change _No response_ ### Code of Conduct - [x] I agree to follow Dify's documentation [contribution guidelines](https://github.com/langgenius/dify/blob/0277a37fcad5ad86aeb239485c27fffd5cd90043/CONTRIBUTING.md) - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields.
yindo added the documentationbug labels 2026-02-16 05:19:43 -05:00
yindo closed this issue 2026-02-16 05:19:43 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 26, 2025):

The "invalid URL" error when calling the API to add chunks in local Dify is almost always caused by frontend or client-side URL validation, not by the backend API itself. Dify's frontend checks that the API base URL is a well-formed HTTP/HTTPS address and may reject URLs that use localhost or private IPs, especially in Docker or containerized setups. If Dify is running in Docker, localhost refers to the container itself, not your host machine, so the API may not be reachable that way. Instead, use your machine's LAN IP (like http://160.1.39.31:1003/v1) or host.docker.internal if supported by your environment, and make sure the port is open and mapped correctly. Always include the full scheme (http:// or https://) in the URL and verify you can reach the API from inside the container (for example, with curl).

If you still see "invalid URL" errors, double-check that the API base URL is correct, the port is accessible, and you are not using curly braces {} in the path—replace them with actual IDs. Also, ensure your Authorization header is set as Bearer <token>. For more details and troubleshooting steps, see this discussion and recent frontend validation changes.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Nov 26, 2025): <!-- Answer --> The "invalid URL" error when calling the API to add chunks in local Dify is almost always caused by frontend or client-side URL validation, not by the backend API itself. Dify's frontend checks that the API base URL is a well-formed HTTP/HTTPS address and may reject URLs that use `localhost` or private IPs, especially in Docker or containerized setups. If Dify is running in Docker, `localhost` refers to the container itself, not your host machine, so the API may not be reachable that way. Instead, use your machine's LAN IP (like `http://160.1.39.31:1003/v1`) or `host.docker.internal` if supported by your environment, and make sure the port is open and mapped correctly. Always include the full scheme (`http://` or `https://`) in the URL and verify you can reach the API from inside the container (for example, with `curl`). If you still see "invalid URL" errors, double-check that the API base URL is correct, the port is accessible, and you are not using curly braces `{}` in the path—replace them with actual IDs. Also, ensure your Authorization header is set as `Bearer <token>`. For more details and troubleshooting steps, see [this discussion](https://github.com/langgenius/dify-docs/issues/535) and [recent frontend validation changes](https://github.com/langgenius/dify/pull/27558). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=other)</sup> [![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20%22invalid%20URL%22%20error%20when%20calling%20the%20API%20to%20add%20chunks%20in%20local%20Dify%20is%20almost%20always%20caused%20by%20frontend%20or%20client-side%20URL%20validation%2C%20not%20by%20the%20backend%20API%20itself.%20Dify%27s%20frontend%20checks%20that%20the%20API%20base%20URL%20is%20a%20well-formed%20HTTP/HTTPS%20address%20and%20may%20reject%20URLs%20that%20use%20%60localhost%60%20or%20private%20IPs%2C%20especially%20in%20Docker%20or%20containerized%20setups.%20If%20Dify%20is%20running%20in%20Docker%2C%20%60localhost%60%20refers%20to%20the%20container%20itself%2C%20not%20your%20host%20machine%2C%20so%20the%20API%20may%20not%20be%20reachable%20that%20way.%20Instead%2C%20use%20your%20machine%27s%20LAN%20IP%20%28like%20%60http%3A//160.1.39.31%3A1003/v1%60%29%20or%20%60host.docker.internal%60%20if%20supported%20by%20your%20environment%2C%20and%20make%20sure%20the%20port%20is%20open%20and%20mapped%20correctly.%20Always%20include%20the%20full%20scheme%20%28%60http%3A//%60%20or%20%60https%3A//%60%29%20in%20the%20URL%20and%20verify%20you%20can%20reach%20the%20API%20from%20inside%20the%20container%20%28for%20example%2C%20with%20%60curl%60%29.%20%0A%0AIf%20you%20still%20see%20%22invalid%20URL%22%20errors%2C%20double-check%20that%20the%20API%20base%20URL%20is%20correct%2C%20the%20port%20is%20accessible%2C%20and%20you%20are%20not%20using%20curly%20braces%20%60%7B%7D%60%20in%20the%20path%E2%80%94replace%20them%20with%20actual%20IDs.%20Also%2C%20ensure%20your%20Authorization%20header%20is%20set%20as%20%60Bearer%20%3Ctoken%3E%60.%20For%20more%20details%20and%20troubleshooting%20steps%2C%20see%20%5Bthis%20discussion%5D%28https%3A//github.com/langgenius/dify-docs/issues/535%29%20and%20%5Brecent%20frontend%20validation%20changes%5D%28https%3A//github.com/langgenius/dify/pull/27558%29.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-docs/issues/543)
Author
Owner

@ThomosShen commented on GitHub (Nov 26, 2025):

@.*** https://go.dosu.dev/dosubot.*Dear dosu,

Thanks for your technical support, I tried to solve the issue with below
methods:

1, add chunks in my local dify directly and checked the log of nginx in
container, the log is:

�10.89.0.1 - - [27/Nov/2025:01:53:36 +0000] "POST
/console/api/datasets/30a922ff-5ced-4d44-ab6f-f305c131644a/documents/2c64b247-8dbe-4037-a79e-480ee725e612/segment
HTTP/1.1" 200 706
"http://127.0.0.1:1003/datasets/30a922ff-5ced-4d44-ab6f-f305c131644a/documents/2c64b247-8dbe-4037-a79e-480ee725e612
http://127.0.0.1:1003/datasets/30a922ff-5ced-4d44-ab6f-f305c131644a/documents/2c64b247-8dbe-4037-a79e-480ee725e612"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/125.0.0.0 http://125.0.0.0 Safari/537.36" "-"�10.89.0.1 - -
[27/Nov/2025:01:53:39 +0000] "GET
/console/api/datasets/30a922ff-5ced-4d44-ab6f-f305c131644a/documents/2c64b247-8dbe-4037-a79e-480ee725e612/segments?page=105&limit=10&keyword=&enabled=all
HTTP/1.1" 200 6491
"http://127.0.0.1:1003/datasets/30a922ff-5ced-4d44-ab6f-f305c131644a/documents/2c64b247-8dbe-4037-a79e-480ee725e612
http://127.0.0.1:1003/datasets/30a922ff-5ced-4d44-ab6f-f305c131644a/documents/2c64b247-8dbe-4037-a79e-480ee725e612"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/125.0.0.0 http://125.0.0.0 Safari/537.36" "-"

2, Update the baseURL in web according to the log above, but still failed.
[image: image.png]

Can you help check and provide solutions?

Best Regards,
Thomos SHEN
dosubot[bot] @.***> 于2025年11月26日周三 15:35写道:

dosubot[bot] left a comment (langgenius/dify-docs#543)
https://github.com/langgenius/dify-docs/issues/543#issuecomment-3579845340

The "invalid URL" error when calling the API to add chunks in local Dify
is almost always caused by frontend or client-side URL validation, not by
the backend API itself. Dify's frontend checks that the API base URL is a
well-formed HTTP/HTTPS address and may reject URLs that use localhost or
private IPs, especially in Docker or containerized setups. If Dify is
running in Docker, localhost refers to the container itself, not your
host machine, so the API may not be reachable that way. Instead, use your
machine's LAN IP (like http://160.1.39.31:1003/v1) or host.docker.internal
if supported by your environment, and make sure the port is open and mapped
correctly. Always include the full scheme (http:// or https://) in the
URL and verify you can reach the API from inside the container (for
example, with curl).

If you still see "invalid URL" errors, double-check that the API base URL
is correct, the port is accessible, and you are not using curly braces {}
in the path—replace them with actual IDs. Also, ensure your Authorization
header is set as Bearer . For more details and troubleshooting
steps, see this discussion
https://github.com/langgenius/dify-docs/issues/535 and recent frontend
validation changes https://github.com/langgenius/dify/pull/27558.

To reply, just mention @dosu https://go.dosu.dev/dosubot.

How did I do? Good
https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=great_response
| Irrelevant
https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=irrelevant_answer
| Incorrect
https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=incorrect_sources
| Verbose
https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=too_verbose
| Hallucination
https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=hallucination
| Report 🐛
https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=bug_report
| Other
https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=other

[image: Open in Cursor]
https://cursor.com/link/prompt?text=The%20%22invalid%20URL%22%20error%20when%20calling%20the%20API%20to%20add%20chunks%20in%20local%20Dify%20is%20almost%20always%20caused%20by%20frontend%20or%20client-side%20URL%20validation%2C%20not%20by%20the%20backend%20API%20itself.%20Dify%27s%20frontend%20checks%20that%20the%20API%20base%20URL%20is%20a%20well-formed%20HTTP/HTTPS%20address%20and%20may%20reject%20URLs%20that%20use%20%60localhost%60%20or%20private%20IPs%2C%20especially%20in%20Docker%20or%20containerized%20setups.%20If%20Dify%20is%20running%20in%20Docker%2C%20%60localhost%60%20refers%20to%20the%20container%20itself%2C%20not%20your%20host%20machine%2C%20so%20the%20API%20may%20not%20be%20reachable%20that%20way.%20Instead%2C%20use%20your%20machine%27s%20LAN%20IP%20%28like%20%60http%3A//160.1.39.31%3A1003/v1%60%29%20or%20%60host.docker.internal%60%20if%20supported%20by%20your%20environment%2C%20and%20make%20sure%20the%20port%20is%20open%20and%20mapped%20correctly.%20Always%20include%20the%20full%20scheme%20%28%60http%3A//%60%20or%20%60https%3A//%60%29%20in%20the%20URL%20and%20verify%20you%20can%20reach%20the%20API%20from%20inside%20the%20container%20%28for%20example%2C%20with%20%60curl%60%29.%20%0A%0AIf%20you%20still%20see%20%22invalid%20URL%22%20errors%2C%20double-check%20that%20the%20API%20base%20URL%20is%20correct%2C%20the%20port%20is%20accessible%2C%20and%20you%20are%20not%20using%20curly%20braces%20%60%7B%7D%60%20in%20the%20path%E2%80%94replace%20them%20with%20actual%20IDs.%20Also%2C%20ensure%20your%20Authorization%20header%20is%20set%20as%20%60Bearer%20%3Ctoken%3E%60.%20For%20more%20details%20and%20troubleshooting%20steps%2C%20see%20%5Bthis%20discussion%5D%28https%3A//github.com/langgenius/dify-docs/issues/535%29%20and%20%5Brecent%20frontend%20validation%20changes%5D%28https%3A//github.com/langgenius/dify/pull/27558%29.
[image: Join Discord] https://go.dosu.dev/discord-bot [image: Share on
X]
https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-docs/issues/543


Reply to this email directly, view it on GitHub
https://github.com/langgenius/dify-docs/issues/543#issuecomment-3579845340,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/A4ARGZ7RRBAFROB3NS453GD36VJ4PAVCNFSM6AAAAACNHIVOASVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKNZZHA2DKMZUGA
.
You are receiving this because you authored the thread.Message ID:
@.***>

@ThomosShen commented on GitHub (Nov 26, 2025): ***@***.*** <https://go.dosu.dev/dosubot>.*Dear dosu, Thanks for your technical support, I tried to solve the issue with below methods: 1, add chunks in my local dify directly and checked the log of nginx in container, the log is: *�10.89.0.1 - - [27/Nov/2025:01:53:36 +0000] "POST /console/api/datasets/30a922ff-5ced-4d44-ab6f-f305c131644a/documents/2c64b247-8dbe-4037-a79e-480ee725e612/segment HTTP/1.1" 200 706 "http://127.0.0.1:1003/datasets/30a922ff-5ced-4d44-ab6f-f305c131644a/documents/2c64b247-8dbe-4037-a79e-480ee725e612 <http://127.0.0.1:1003/datasets/30a922ff-5ced-4d44-ab6f-f305c131644a/documents/2c64b247-8dbe-4037-a79e-480ee725e612>" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 <http://125.0.0.0> Safari/537.36" "-"�10.89.0.1 - - [27/Nov/2025:01:53:39 +0000] "GET /console/api/datasets/30a922ff-5ced-4d44-ab6f-f305c131644a/documents/2c64b247-8dbe-4037-a79e-480ee725e612/segments?page=105&limit=10&keyword=&enabled=all HTTP/1.1" 200 6491 "http://127.0.0.1:1003/datasets/30a922ff-5ced-4d44-ab6f-f305c131644a/documents/2c64b247-8dbe-4037-a79e-480ee725e612 <http://127.0.0.1:1003/datasets/30a922ff-5ced-4d44-ab6f-f305c131644a/documents/2c64b247-8dbe-4037-a79e-480ee725e612>" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 <http://125.0.0.0> Safari/537.36" "-"* 2, Update the baseURL in web according to the log above, but still failed. [image: image.png] Can you help check and provide solutions? Best Regards, Thomos SHEN dosubot[bot] ***@***.***> 于2025年11月26日周三 15:35写道: > *dosubot[bot]* left a comment (langgenius/dify-docs#543) > <https://github.com/langgenius/dify-docs/issues/543#issuecomment-3579845340> > > The "invalid URL" error when calling the API to add chunks in local Dify > is almost always caused by frontend or client-side URL validation, not by > the backend API itself. Dify's frontend checks that the API base URL is a > well-formed HTTP/HTTPS address and may reject URLs that use localhost or > private IPs, especially in Docker or containerized setups. If Dify is > running in Docker, localhost refers to the container itself, not your > host machine, so the API may not be reachable that way. Instead, use your > machine's LAN IP (like http://160.1.39.31:1003/v1) or host.docker.internal > if supported by your environment, and make sure the port is open and mapped > correctly. Always include the full scheme (http:// or https://) in the > URL and verify you can reach the API from inside the container (for > example, with curl). > > If you still see "invalid URL" errors, double-check that the API base URL > is correct, the port is accessible, and you are not using curly braces {} > in the path—replace them with actual IDs. Also, ensure your Authorization > header is set as Bearer <token>. For more details and troubleshooting > steps, see this discussion > <https://github.com/langgenius/dify-docs/issues/535> and recent frontend > validation changes <https://github.com/langgenius/dify/pull/27558>. > > *To reply, just mention @dosu <https://go.dosu.dev/dosubot>.* > ------------------------------ > > How did I do? Good > <https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=great_response> > | Irrelevant > <https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=irrelevant_answer> > | Incorrect > <https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=incorrect_sources> > | Verbose > <https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=too_verbose> > | Hallucination > <https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=hallucination> > | Report 🐛 > <https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=bug_report> > | Other > <https://app.dosu.dev/response-feedback/99265a34-fb01-4bcd-b334-7f0b39deacdd?feedback_type=other> > > [image: Open in Cursor] > <https://cursor.com/link/prompt?text=The%20%22invalid%20URL%22%20error%20when%20calling%20the%20API%20to%20add%20chunks%20in%20local%20Dify%20is%20almost%20always%20caused%20by%20frontend%20or%20client-side%20URL%20validation%2C%20not%20by%20the%20backend%20API%20itself.%20Dify%27s%20frontend%20checks%20that%20the%20API%20base%20URL%20is%20a%20well-formed%20HTTP/HTTPS%20address%20and%20may%20reject%20URLs%20that%20use%20%60localhost%60%20or%20private%20IPs%2C%20especially%20in%20Docker%20or%20containerized%20setups.%20If%20Dify%20is%20running%20in%20Docker%2C%20%60localhost%60%20refers%20to%20the%20container%20itself%2C%20not%20your%20host%20machine%2C%20so%20the%20API%20may%20not%20be%20reachable%20that%20way.%20Instead%2C%20use%20your%20machine%27s%20LAN%20IP%20%28like%20%60http%3A//160.1.39.31%3A1003/v1%60%29%20or%20%60host.docker.internal%60%20if%20supported%20by%20your%20environment%2C%20and%20make%20sure%20the%20port%20is%20open%20and%20mapped%20correctly.%20Always%20include%20the%20full%20scheme%20%28%60http%3A//%60%20or%20%60https%3A//%60%29%20in%20the%20URL%20and%20verify%20you%20can%20reach%20the%20API%20from%20inside%20the%20container%20%28for%20example%2C%20with%20%60curl%60%29.%20%0A%0AIf%20you%20still%20see%20%22invalid%20URL%22%20errors%2C%20double-check%20that%20the%20API%20base%20URL%20is%20correct%2C%20the%20port%20is%20accessible%2C%20and%20you%20are%20not%20using%20curly%20braces%20%60%7B%7D%60%20in%20the%20path%E2%80%94replace%20them%20with%20actual%20IDs.%20Also%2C%20ensure%20your%20Authorization%20header%20is%20set%20as%20%60Bearer%20%3Ctoken%3E%60.%20For%20more%20details%20and%20troubleshooting%20steps%2C%20see%20%5Bthis%20discussion%5D%28https%3A//github.com/langgenius/dify-docs/issues/535%29%20and%20%5Brecent%20frontend%20validation%20changes%5D%28https%3A//github.com/langgenius/dify/pull/27558%29.> > [image: Join Discord] <https://go.dosu.dev/discord-bot> [image: Share on > X] > <https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-docs/issues/543> > > — > Reply to this email directly, view it on GitHub > <https://github.com/langgenius/dify-docs/issues/543#issuecomment-3579845340>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/A4ARGZ7RRBAFROB3NS453GD36VJ4PAVCNFSM6AAAAACNHIVOASVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKNZZHA2DKMZUGA> > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> >
Author
Owner

@dosubot[bot] commented on GitHub (Nov 26, 2025):

The root cause is strict frontend validation in Dify: the web UI blocks API base URLs that use localhost, 127.0.0.1, or private IPs (like 10.x.x.x, 192.168.x.x, etc.), even if your backend is reachable and working. This was made stricter in recent updates, which now use the browser’s URL constructor and explicit checks for private/local addresses, causing “invalid URL” errors before any request is sent (source, PR #27558).

To resolve this:

  1. Use your machine’s LAN IP (not localhost or 127.0.0.1) as the API base URL, e.g., http://192.168.x.x:1003/v1.
  2. If running Dify in Docker, try host.docker.internal (if supported by your OS/Docker version).
  3. Always include the full http:// or https:// scheme.
  4. Test API reachability from inside the container with curl to confirm the address works from the frontend’s perspective.
  5. Avoid curly braces {} in the URL path—replace them with actual dataset and document IDs.

If you still get “invalid URL” errors, please share:

  • The exact base URL you’re entering in the web/API tool.
  • The full error message or screenshot.
  • How your frontend and backend are deployed (same container, different containers, or host).
  • Any errors in your browser’s developer console.

This will help pinpoint any remaining network or config issues.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Nov 26, 2025): <!-- Answer --> The root cause is strict frontend validation in Dify: the web UI blocks API base URLs that use localhost, 127.0.0.1, or private IPs (like 10.x.x.x, 192.168.x.x, etc.), even if your backend is reachable and working. This was made stricter in recent updates, which now use the browser’s URL constructor and explicit checks for private/local addresses, causing “invalid URL” errors before any request is sent ([source](https://github.com/langgenius/dify/blob/01afa5616652e3cdf41029b6a4e95f0742c504d1/web/utils/urlValidation.ts#L8-L64), [PR #27558](https://github.com/langgenius/dify/pull/27558)). To resolve this: 1. Use your machine’s LAN IP (not localhost or 127.0.0.1) as the API base URL, e.g., `http://192.168.x.x:1003/v1`. 2. If running Dify in Docker, try `host.docker.internal` (if supported by your OS/Docker version). 3. Always include the full `http://` or `https://` scheme. 4. Test API reachability from inside the container with `curl` to confirm the address works from the frontend’s perspective. 5. Avoid curly braces `{}` in the URL path—replace them with actual dataset and document IDs. If you still get “invalid URL” errors, please share: - The exact base URL you’re entering in the web/API tool. - The full error message or screenshot. - How your frontend and backend are deployed (same container, different containers, or host). - Any errors in your browser’s developer console. This will help pinpoint any remaining network or config issues. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/ed7220e7-a681-47aa-ae1f-025c3ae754ac?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/ed7220e7-a681-47aa-ae1f-025c3ae754ac?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/ed7220e7-a681-47aa-ae1f-025c3ae754ac?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/ed7220e7-a681-47aa-ae1f-025c3ae754ac?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/ed7220e7-a681-47aa-ae1f-025c3ae754ac?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/ed7220e7-a681-47aa-ae1f-025c3ae754ac?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/ed7220e7-a681-47aa-ae1f-025c3ae754ac?feedback_type=other)</sup> [![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20root%20cause%20is%20strict%20frontend%20validation%20in%20Dify%3A%20the%20web%20UI%20blocks%20API%20base%20URLs%20that%20use%20localhost%2C%20127.0.0.1%2C%20or%20private%20IPs%20%28like%2010.x.x.x%2C%20192.168.x.x%2C%20etc.%29%2C%20even%20if%20your%20backend%20is%20reachable%20and%20working.%20This%20was%20made%20stricter%20in%20recent%20updates%2C%20which%20now%20use%20the%20browser%E2%80%99s%20URL%20constructor%20and%20explicit%20checks%20for%20private/local%20addresses%2C%20causing%20%E2%80%9Cinvalid%20URL%E2%80%9D%20errors%20before%20any%20request%20is%20sent%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/blob/01afa5616652e3cdf41029b6a4e95f0742c504d1/web/utils/urlValidation.ts%23L8-L64%29%2C%20%5BPR%20%2327558%5D%28https%3A//github.com/langgenius/dify/pull/27558%29%29.%0A%0ATo%20resolve%20this%3A%0A1.%20Use%20your%20machine%E2%80%99s%20LAN%20IP%20%28not%20localhost%20or%20127.0.0.1%29%20as%20the%20API%20base%20URL%2C%20e.g.%2C%20%60http%3A//192.168.x.x%3A1003/v1%60.%0A2.%20If%20running%20Dify%20in%20Docker%2C%20try%20%60host.docker.internal%60%20%28if%20supported%20by%20your%20OS/Docker%20version%29.%0A3.%20Always%20include%20the%20full%20%60http%3A//%60%20or%20%60https%3A//%60%20scheme.%0A4.%20Test%20API%20reachability%20from%20inside%20the%20container%20with%20%60curl%60%20to%20confirm%20the%20address%20works%20from%20the%20frontend%E2%80%99s%20perspective.%0A5.%20Avoid%20curly%20braces%20%60%7B%7D%60%20in%20the%20URL%20path%E2%80%94replace%20them%20with%20actual%20dataset%20and%20document%20IDs.%0A%0AIf%20you%20still%20get%20%E2%80%9Cinvalid%20URL%E2%80%9D%20errors%2C%20please%20share%3A%0A-%20The%20exact%20base%20URL%20you%E2%80%99re%20entering%20in%20the%20web/API%20tool.%0A-%20The%20full%20error%20message%20or%20screenshot.%0A-%20How%20your%20frontend%20and%20backend%20are%20deployed%20%28same%20container%2C%20different%20containers%2C%20or%20host%29.%0A-%20Any%20errors%20in%20your%20browser%E2%80%99s%20developer%20console.%0A%0AThis%20will%20help%20pinpoint%20any%20remaining%20network%20or%20config%20issues.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-docs/issues/543)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-docs#277