Skip to content

Install Strapi v5 in Sub-Path on Server not working #21184

@JWandscheer

Description

@JWandscheer

Bug report

Required System information

  • Node.js version: v18
  • Strapi version: 5.0.0-rc.17
  • Database: postgres
  • Operating system: Linux
  • Is your project Javascript or Typescript: Typescript

Describe the bug

Installing Strapi in a Sub-Path on a Server (f.e. https://rooturl.tld/backend) seems nearly unpossible. In a fresh install with server config url: https://rooturl.tld/backend/ and admin config admin-url: /admin (at build-time and runtime) the admin page generally loads (http 200) in /backend/admin, but the resources are loaded from the root path (https://rooturl.tld/strapi-BA4UeQmR.js). This leads to 404 and a blank page.

Steps to reproduce the behavior

  1. Build Strapi with ENV URL=https:/rooturl.tld/backend/, ENV ADMIN_URL=/admin
  2. Run Container
  3. Admin Page is blank because js resources could not be loaded

Expected behavior

The resources should not ignore server-paths.

Code snippets

We are running strapi in a kubernetes cluster and have a rewrite in our virtual service:

- name: "backend-routes"
    match:
    - uri:
        prefix: "/backend/"
    rewrite:
      uri: "/"
    route:
    - destination:
        host: strapi-backend
        port:
          number: 1337

We already tried nearly all permutations in rewriting, ENV URL/ADMIN URL setting (like ADMIN_URL=/backend/admin) etc., but the initial javascript is always requested from the root url.

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: bugIssue reporting a bugseverity: highIf it breaks the basic use of the productsource: core:coreSource is core/corestatus: confirmedConfirmed by a Strapi Team member or multiple community membersversion: 5Issue is present in Strapi 5

    Type

    No type

    Projects

    Status

    Fixed/Shipped

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions