You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When updating the server.js to include url: env('PUBLIC_URL', 'http://localhost:1337') the admin interface routes don't get set correctly since the env var is not included in docker build container.
set environment variable: PUBLIC_URL=http://localhost:1337/cms
run: docker build -t strapi . docker run strapi
Strapi says that admin url is http://localhost:1337/cms/admin
Navigating to http://localhost:1337/cms/admin loads the html, but the JS paths are <script src='/admin/main.....' />, not <script src='/cms/admin/main.....' /> (note the missing /cms).
This is due to admin panel being built in React and it needs to know the url during build time to correctly set the paths.
πββοΈ Expected behavior/code
When environment variable for url is set, the admin dashboard is built using the appropriate url.
π Bug Report
π€·ββοΈ What did you do
When updating the
server.js
to includeurl: env('PUBLIC_URL', 'http://localhost:1337')
the admin interface routes don't get set correctly since the env var is not included in docker build container.E.g.
server.js
url: env('PUBLIC_URL', 'http://localhost:1337')
set environment variable:
PUBLIC_URL=http://localhost:1337/cms
run:
docker build -t strapi .
docker run strapi
Strapi says that admin url is
http://localhost:1337/cms/admin
Navigating to
http://localhost:1337/cms/admin
loads the html, but the JS paths are<script src='/admin/main.....' />
, not<script src='/cms/admin/main.....' />
(note the missing/cms
).This is due to admin panel being built in React and it needs to know the url during build time to correctly set the paths.
πββοΈ Expected behavior/code
When environment variable for url is set, the admin dashboard is built using the appropriate url.
π©βπ» Environment
π‘ Possible Solution
Add following lines to generated
Dockerfile
:Note: the name
PUBLIC_URL
needs to be the same as the argument in yoururl: env('PUBLIC_URL')
call inserver.js
The text was updated successfully, but these errors were encountered: