Skip to content

Unable to change URL(host) for web-server hot-reload #179406

Description

@BirjuVachhani

Steps to reproduce

I am running flutter web server using flutter run -d web-server command. Hot-reload on it works just fine when I access it from localhost. But when I expose it from a Nginx proxy config, it fails to hot-reload and it tries to make a request to following address which gets blocked.

http://localhost:3002/reloaded_sources.json

When running behind the proxy URL, (Assume https://example.com) it should use the proxy's URL (e.g.https://example.com/reloaded_sources.json) and should support hot-reloading.

I couldn't find any flag on flutter run command that can make this work.

I even tried Cloudflare tunnels to test this and they are failing too.

Expected results

Instead of fetching http://localhost:3002/reloaded_sources.json, it should make a request to https://example.com/reloaded_sources.json.

Actual results

Hot-reload on web doesn't work when behind Nginx proxy and it makes a request to localhost: http://localhost:3002/reloaded_sources.json.

Code sample

Code sample
flutter run -d web-server --web-port 3001 --web-launch-url https://example.com

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.38.3, on macOS 26.1 25B78 darwin-arm64, locale en-US) [924ms]
    • Flutter version 3.38.3 on channel stable at /Volumes/Storage/Data/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 19074d12f7 (13 days ago), 2025-11-20 17:53:13 -0500
    • Engine revision 13e658725d
    • Dart version 3.10.1
    • DevTools version 2.51.1
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, 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-rc1) [3.1s]
    • Android SDK at /Volumes/Storage/Data/Android/Sdk
    • Emulator version 36.2.12.0 (build_id 14214601) (CL:N/A)
    • Platform android-36.1, build-tools 36.1.0-rc1
    • ANDROID_HOME = /Volumes/Storage/Data/Android/Sdk
    • ANDROID_SDK_ROOT = /Volumes/Storage/Data/Android/Sdk
    • Java binary at: /Volumes/Storage/Data/JetBrains/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.8+-14196175-b1038.72)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 26.1.1) [1,947ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 17B100
    • CocoaPods version 1.16.2

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

[✓] Connected device (3 available) [5.9s]
    • Birju’s iPhone (wireless) (mobile) • 00008110-000E35A83A82401E • ios            • iOS 26.1 23B85
    • macOS (desktop)                    • macos                     • darwin-arm64   • macOS 26.1 25B78 darwin-arm64
    • Chrome (web)                       • chrome                    • web-javascript • Google Chrome 143.0.7499.40

[✓] Network resources [2.0s]
    • All expected network resources are available.

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: buildBuilding flutter applications with the toolfound in release: 3.38Found to occur in 3.38found in release: 3.39Found to occur in 3.39fyi-toolFor the attention of Flutter Tool teamhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyt: hot reloadReloading code during "flutter run"team-webOwned by Web platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-webTriaged by Web platform 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