Skip to content

[🐛 BUG] Using the base_url configuration causes a 404 response on .js files. #2726

@kalimalrazif

Description

@kalimalrazif

🔍 What went wrong?

I'm developing an app with Taipy, and I need to set the base_url parameter. When I run the application using the following code,

tp.run(
        tui,
        port=port,
        host=host,
        debug=debug,
        title=core_container.config.taipy.title(),
        base_url=root_path,
        run_browser=False,
        dark_mode=False,
        use_reloader=reload,
        time_zone="America/Mexico_City",
        notification_duration=5000,
        watermark="",
        # async_mode="gevent",
        stylekit=style_kit,
        flask_log=True,
    )

HTML code:

<!doctype html>
<html lang="en">
    <head>
        <base href="/wholesale_report/"/>
        <meta charset="utf-8"/>
        <meta name="viewport" content="width=device-width,initial-scale=1"/>
        <link rel="manifest" href="manifest.json"/>
        <link rel="icon" type="image/png" href="favicon.png" class="taipy-favicon" data-url="https://raw.githubusercontent.com/Avaiga/taipy-assets/develop/favicon.png?version=4.1.0"/>
        <link rel="apple-touch-icon" href="favicon.png"/>
        <title>Wholesale Client Report</title>
        <script>window.taipyConfig={"baseURL": "/wholesale_report/", "darkMode": false, "extensions": {"./taipy-extension/TaipyGuiCore": ["ScenarioSelector", "Scenario", "ScenarioDag", "DataNodeSelector", "DataNode", "JobSelector"]}, "stylekit": {"borderRadius": 8, "colorBackgroundDark": "#152335", "colorBackgroundLight": "transparent", "colorError": "#ff4d1d", "colorPaperDark": "#1f2f44", "colorPaperLight": "#ffffff", "colorPrimary": "#1e88e5", "colorSecondary": "#7f56d9", "colorSuccess": "#52c41a", "colorWarning": "#fec84b", "fontFamily": "Lato, Arial, sans-serif", "inputButtonHeight": "48px", "rootMargin": "1rem"}, "timeZone": "America/Mexico_City"};window.taipyVersion="4.1.0";
        </script>
        <style>:root{--color-primary:#1e88e5; --color-secondary:#7f56d9; --color-error:#ff4d1d; --color-warning:#fec84b; --color-success:#52c41a; --color-background-light:transparent; --color-paper-light:#ffffff; --color-background-dark:#152335; --color-paper-dark:#1f2f44; --font-family:"Lato, Arial, sans-serif"; --root-margin:1rem; --border-radius:8px; --input-button-height:48px;    }</style>
        <script defer="defer" src="taipy-gui-deps.dll.js?2e5e009c67dfd8a6d450"></script>
        <script defer="defer" src="taipy-gui.js?2e5e009c67dfd8a6d450"></script>
        <script defer="defer" src="taipy-gui-dom.js?2e5e009c67dfd8a6d450"></script>
    </head>
    <body>
        <script defer="defer" src="taipy-extension/taipy_gui_core/lib/taipy-gui-core.js?v=4.1.0"></script>
        <link rel="stylesheet" href="stylekit/stylekit.css"/>
        <noscript>You need to enable JavaScript to run this app.</noscript>
        <div id="root"></div>
    </body>
</html>

the HTML is correctly configured as shown above, but the service returns 404 errors, for example:

INFO     2025-09-17 14:49:31.231 request id: app - logging:callHandlers - 127.0.0.1 - - [2025-09-17 14:49:31] "GET /wholesale_report/ HTTP/1.1" 200 2200 0.005067
INFO     2025-09-17 14:49:31.240 request id: app - logging:callHandlers - 127.0.0.1 - - [2025-09-17 14:49:31] "GET /wholesale_report/taipy-gui-deps.dll.js?2e5e009c67dfd8a6d450 HTTP/1.1" 404 154 0.000861
INFO     2025-09-17 14:49:31.242 request id: app - logging:callHandlers - 127.0.0.1 - - [2025-09-17 14:49:31] "GET /wholesale_report/taipy-gui.js?2e5e009c67dfd8a6d450 HTTP/1.1" 404 154 0.000584
INFO     2025-09-17 14:49:31.243 request id: app - logging:callHandlers - 127.0.0.1 - - [2025-09-17 14:49:31] "GET /wholesale_report/stylekit/stylekit.css HTTP/1.1" 404 154 0.000651
INFO     2025-09-17 14:49:31.244 request id: app - logging:callHandlers - 127.0.0.1 - - [2025-09-17 14:49:31] "GET /wholesale_report/taipy-gui-dom.js?2e5e009c67dfd8a6d450 HTTP/1.1" 404 154 0.000417
INFO     2025-09-17 14:49:31.245 request id: app - logging:callHandlers - 127.0.0.1 - - [2025-09-17 14:49:31] "GET /wholesale_report/taipy-extension/taipy_gui_core/lib/taipy-gui-core.js?v=4.1.0 HTTP/1.1" 404 154 0.000472
INFO     2025-09-17 14:49:31.250 request id: app - logging:callHandlers - 127.0.0.1 - - [2025-09-17 14:49:31] "GET /.well-known/appspecific/com.chrome.devtools.json HTTP/1.1" 404 154 0.000548
INFO     2025-09-17 14:49:31.266 request id: app - logging:callHandlers - 127.0.0.1 - - [2025-09-17 14:49:31] "GET /wholesale_report/manifest.json HTTP/1.1" 404 154 0.000622
INFO     2025-09-17 15:10:15.124 request id: app - logging:callHandlers - 127.0.0.1 - - [2025-09-17 15:10:15] "GET /wholesale_report/ HTTP/1.1" 200 2200 0.000844
INFO     2025-09-17 15:10:15.141 request id: app - logging:callHandlers - 127.0.0.1 - - [2025-09-17 15:10:15] "GET /favicon.ico HTTP/1.1" 200 4382 0.001400

✅ Expected Behavior

The expected behavior should be that the service should correctly return the files with the base_url content as a prefix.

🖼️ Screenshots (Optional)

App logs:
Image

Page source:
Image

📦 Taipy Version

4.1.0

📋 Additional Context (Optional)

📜 Code of Conduct

  • I have checked the existing issues to avoid duplicates.
  • I am willing to work on this issue (optional)

✅ Acceptance Criteria

  • A reproducible unit test is added.
  • Code coverage is at least 90%.
  • The bug reporter validated the fix.
  • Relevant documentation updates or an issue created in

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions