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.

Make Asset Paths Relative

See original GitHub issue

Deploying code-server to a nested URL such as /code will result in assets being requested from /, when they should be /code.

The HTML source code references root-level assets:

<script type="text/javascript" src="main.js"></script>

We should, instead, allow users to specify if they are hosting on a nested URL like /code, thus appending the host to the HTML:

./code-server --host=0.0.0.0/code
<script type="text/javascript" src="/code/main.js"></script>

Reproduction Steps

  1. Deploy to a URL like /code, or /johhny/codes
  2. Start code server
  3. Visit the URL, and observe that assets are not requested from the desired URL (code), but instead, are requested from the root / URL

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
RyanEwencommented, Apr 30, 2019

I just wanted to report that this does work, however if not logged in I get redirected away from my /code/ to /login/ which doesn’t exist (should be /code/login/)

0reactions
code-ashercommented, Apr 18, 2019

It’s relative, so you don’t need to specify anything. If code server is available at /code, resource requests will go to /code/resource, for example.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a way to build html with relative assets url? · Issue #206
A common practice is to only host the dist (or public) dir using a static server. But with absolute path, it cannot find...
Read more >
Make Assets Relative Path (Strip Path) - YouTube
Quick Navigation:0:00​ Introduction0:48​ Method 11:30​ Method 21:56​ Method 3.
Read more >
Relative paths in dynamic creatives - Studio Help
Use relative paths for Dynamic creatives · On the "Assets" tab, upload your assets to Asset Library. · Navigate to the parent folder...
Read more >
Changing Absolute Paths to Relative Paths in 3ds Max
a) Within the Asset Tracking window, highlight all of your assets, click "Paths", then click "Strip Path". (Depending on the number of assets...
Read more >
Laravel asset vs relative paths - Stack Overflow
The first is a relative path (relative to the public dir) and the second generates an absolute path. Besides that, is there any...
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