Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Admin page not working when setting a PUBLIC_URL #308

Open
cnmuc opened this issue Jul 14, 2021 · 5 comments
Open

Admin page not working when setting a PUBLIC_URL #308

cnmuc opened this issue Jul 14, 2021 · 5 comments

Comments

@cnmuc
Copy link

cnmuc commented Jul 14, 2021

When setting a PUBLIC_URL via server.js, the admin page opens correctly at https://example.com/strapi/dashboard
However, the javascript files in the HTML page cannot be loaded (cf. screenshot) as the PUBLIC_URL (PUBLIC_ADMIN_URL) seems not to be used.

module.exports = ({ env }) => ({
  host: env('HOST', '0.0.0.0'),
  port: env.int('PORT', 1337),
  url: env('PUBLIC_URL', 'https://example.com/strapi'),
  proxy: env.bool('IS_PROXIED', true),
  admin: {
    auth: {
      secret: env('ADMIN_JWT_SECRET', 'myadminsecret'),
    },
	url: env('PUBLIC_ADMIN_URL', '/dashboard'),
  },
});

image

/admin/runtime~main.d1293aad.js

should be

/strapi/dashboard/runtime~main.d1293aad.js

@ghost
Copy link

ghost commented Aug 2, 2021

Make sure to set those environment files during the build stage of your Dockerfile.

@vinzenzweber
Copy link

@ChristianHeimke
Copy link

did you run the strapi build command after changing the configuration? Afaik the strapi web ui needs to recompile after changing such fundamental configuration.

@arielhernandezmusa
Copy link

arielhernandezmusa commented Jul 31, 2022

If the URL is defined at build time, then the output image is tied to that url and can not be reused to deploy to different environments like dev, qa, prod …

A suggestion is that the public url for the admin ui must be set at runtime instead of build time, but I think this can be archived on the docker files not in strapi side

@emilselroos
Copy link

Does anyone know whether this has been improved yet?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants