Skip to content

reloaded_sources.json is returning incorrect src url in response #184060

Description

@BirjuVachhani

Steps to reproduce

  1. Run flutter run -d web-server behind a reverse proxy with a domain. e.g. example.com
  2. Open the URL in browser. This would be example.com, not localhost:<port>.
  3. Hot Reload.
  4. The loaded web app makes a request to reloaded_sources.json endpoint.
  5. Inspect the response.

reloaded_sources.json returns following

[{
    "src": "http://localhost:15488/packages/my_flutter_app/main.dart.lib.js",
    "module": "packages/my_flutter_app/main.dart",
    "libraries": ["package:my_flutter_app/main.dart"]
}]

Notice that the src param returns a full url which points to localhost. This is very problematic as this breaks reverse proxies and URLs used for it.

Note: There is a tracking issue #179406 where reloaded_sources.json is being requested on a localhost URL too but I was able to get past it with an script but then got hit with this.

Expected results

src should return the relative path only excluding the host and port. The host and port then should be reconstructed on the client based on the loaded URL in the browser.

Actual results

src contains full URL that points to localhost which breaks reverse proxies.

Code sample

Code sample
flutter create . --platforms=web

Screenshots or Video

Screenshots / Video demonstration Image

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.41.5, on macOS 26.3.1 25D771280a darwin-arm64, locale en-IN) [1,486ms]
    • Flutter version 3.41.5 on channel stable at /Users/birjuvachhani/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2c9eb20739 (2 days ago), 2026-03-17 16:14:01 -0700
    • Engine revision 052f31d115
    • Dart version 3.11.3
    • DevTools version 2.54.2
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, enable-custom-devices, cli-animations, enable-native-assets, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration

[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [10.4s]
    • Android SDK at /Users/birjuvachhani/Library/Android/sdk
    • Emulator version 36.4.10.0 (build_id 15004761) (CL:N/A)
    • Platform android-36, build-tools 36.1.0
    • ANDROID_HOME = /Users/birjuvachhani/Library/Android/sdk
    • Java binary at: /usr/bin/java
      This JDK was found in the system PATH.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version Java(TM) SE Runtime Environment (build 21.0.9+7-LTS-338)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 26.3) [4.9s]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 17C529
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [5ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Connected device (4 available) [10.1s]
    • Birju’s iPhone (wireless) (mobile)  • 00008110-000E35A83A82401E • ios            • iOS 26.3.1 23D8133
    • Jemini’s iPhone (wireless) (mobile) • 00008110-001E6D5C34C0A01E • ios            • iOS 26.3.1 23D8133
    • macOS (desktop)                     • macos                     • darwin-arm64   • macOS 26.3.1 25D771280a darwin-arm64
    • Chrome (web)                        • chrome                    • web-javascript • Google Chrome 146.0.7680.81

[✓] Network resources [1,286ms]
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyteam-toolOwned by Flutter Tool teamtriaged-toolTriaged by Flutter Tool team

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions