Skip to content

Is Flutter web not capable of being published to a sub-folder? #52901

@jlubeck

Description

@jlubeck

I have my web app deployed into www.domain.com/app and I'm getting these errors in Chrome

GET https://www.domain.com/manifest.json 404 (Not Found)

Uncaught (in promise) TypeError: Failed to register a ServiceWorker for scope ('https://www.domain.com/') with script ('https://www.domain.com/flutter_service_worker.js'): A bad HTTP response code (404) was received when fetching the script.

As you can see it's trying to look for files in the root instead of the folder. So are there any configuration files or options to the build command to change this? The docs about deploying web apps don't mention anything like it

Steps to Reproduce

  1. Run flutter build web.
  2. Upload files into a sub-folder in a server
  3. See errors in console

Expected results:

Everything should work

Actual results:

Logs
flutter analyze
Analyzing rpm...                                                        
No issues found! (ran in 9.6s)
[✓] Flutter (Channel beta, v1.15.17, on Mac OS X 10.15.3 19D76, locale en-US)
    • Flutter version 1.15.17 at /Users/jan/flutter
    • Framework revision 2294d75bfa (13 days ago), 2020-03-07 00:28:38 +0900
    • Engine revision 5aff311948
    • Dart version 2.8.0 (build 2.8.0-dev.12.0 9983424a3c)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/jan/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C504
    • CocoaPods version 1.8.4

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

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 43.0.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[!] VS Code (version 1.42.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • iPad Pro (9.7-inch) • 196939CF-6CE1-42D9-A844-ACCAE2DC81F2 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-13-3
      (simulator)
    • Chrome              • chrome                               • web-javascript • Google Chrome 80.0.3987.149
    • Web Server          • web-server                           • web-javascript • Flutter Tools

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions