Make Asset Paths Relative
See original GitHub issueDeploying 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
- Deploy to a URL like
/code
, or/johhny/codes
- Start code server
- 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:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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/)
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.