question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding a relative path to the baseUrl shows empty screen

See original GitHub issue

Expected Behavior

I want the backstage application to be loaded at http://www.mywebsite.com/backstage. When adding a relative path to the baseUrl in app-config.yaml to ‘http://localhost:3000/backstage’, it should load the backstage home catalog screen with the relative path.

Current Behavior

Shows an empty screen redirecting to http://localhost:3000/catalog

Steps to Reproduce

  1. Update baseurl in app-config.yaml to baseUrl: http://localhost:3000/backstage
  2. Start the app

Context

I want the backstage application to be loaded at http://www.mywebsite.com/backstage.

  • I tried updating the baseurl to ‘http://localhost:3000/backstage’. It shows an empty screen. Added <Navigate key="/" to="/lowesbs/catalog" /> in app.tsx, loads the app but fails on refresh, Cannot GET /backstage/catalog

Also when pushed to a dev env with the relative path, it shows this below error

Refused to apply style from ‘http://localhost:7000/backstage/static/asyncapi.2.a6b20294.css’ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled. Refused to apply style from ‘http://localhost:7000/backstage/static/swagger-ui-react.33.8237198d.css’ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled. Refused to execute script from ‘<URL>’ because its MIME type (‘text/html’) is not executable, and strict MIME type checking is enabled.

  • Tried to keep the baseurl as it is and update the routes to add a relative path, <Routes basename='/backstage'>. Works good. No refresh issue, but pushing it to a dev env, its not able to get the assets, get 503 error for all assets. Added “homepage” in package.json to load the assets but fails.

Your Environment

  • NodeJS Version (v12): 12.14.1
  • Operating System and Version : Mac OS
  • Browser Information: Chrome

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Rugvipcommented, Feb 22, 2021

We looked at this a while back and react-router didn’t have a great solution for us. Tricky bit without support from react-router is that all the links in the app will be wrong, e.g. the hardcoded /catalog. Composability work should allow us to set a global base path though, so once we’ve migrated the rest of the apps we should be able to fix this.

0reactions
Hanyman8commented, Jun 30, 2022

Same usecase here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to the Fix Base URL Malformed or Empty Issue
The situation occurs if there is an error in the base tag. It may be caused by incorrect formatting of the base URL,...
Read more >
How can I set a URL for a blank tab without loading the page?
It works as expected so far but the problem is the new tab doesn't have a URL associated with it so all the...
Read more >
relativePath | Apple Developer Documentation
The relative path, or an empty string if the URL has an empty path. Discussion. This is the same as path if baseURL...
Read more >
Secret tricks for path-independent Angular apps - Symflower
It only shows a blank screen. ... Making Angular use a relative path for your app ... the document base URL is set...
Read more >
The Document Base URL element - HTML - MDN Web Docs
The HTML element specifies the base URL to use for all relative URLs in a document. There can be only one element in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found