Fixes to allow UI to be deployed on a subpath (e.g. nameSpace: /dspace)#1488
Fixes to allow UI to be deployed on a subpath (e.g. nameSpace: /dspace)#1488tdonohue wants to merge 4 commits intoDSpace:mainfrom
nameSpace: /dspace)#1488Conversation
|
@artlowel : Would you (or someone on your team) be willing to give this a quick review? It should be an easy one to test/review. |
artlowel
left a comment
There was a problem hiding this comment.
Thanks @tdonohue
While this PR fixes some of the obvious problems you have when deploying on a different namespace, the express server is still hosted on / as well (try simply going to http://localhost:4000/ with this PR). This hides a lot of other problems.
If you take a look at the server output you'll see that most things are still being served from /
Environment extended with app config
[HPM] Proxy created: / -> https://api7.dspace.org/server/sitemaps
[17:02:39 GMT+0100 (Central European Standard Time)] Listening at http://localhost:4000/dspace/ui/
Environment: Production
GET /dspace/ui 200 2465.929 ms - -
GET /styles.0324863878df4752a58c.css 200 2.994 ms - 346
GET /dspace-theme.css 200 2.868 ms - -
GET /assets/images/dspace-logo.svg 200 1.188 ms - -
GET /assets/dspace/images/banner.jpg 200 0.977 ms - 1671429
GET /assets/fonts/fa-solid-900.woff2 200 0.747 ms - 78268
GET /assets/dspace/images/favicons/manifest.webmanifest 200 0.715 ms - 436
Usually when you deploy something on a subpath, you stick an apache or nginx in front of it that will only redirect requests within that subpath to your server. If you were to do that here, css, fonts and images wouldn't load.
This article explains how to use a router in express to deploy an app to a subpath (note that this should include the /sitemap and /iiif routes as well, basically everything in a server.use() and likely a
server.get() as well). But afterwards I expect other paths will need fixing too, e.g. the image path.
|
I'm sorry I see that I forgot the part about setting the |
|
If I do that, all requests do go the the correct subpath, but all but the initial HTML return a 404. As a consequence, styles, fonts, images and js files don't load: Let me know if I'm still doing something wrong |
|
@artlowel : I think you are correct that the However, for me, this PR does get styles to load (at least for me it works)...but you need a very specific configuration:
Overall, my goal in this PR was to get the UI |
|
@artlowel : Ok, I take it back. I just retested, and something is broken in this PR. It's not working for me either anymore. I thought I had it working, but I must have broken something along the way. I'll ping you once I get it working again. |
|
@artlowel : I got this working again by going with the Express Router approach. However, even that doesn't seem to solve I had initially thought this would be a simple fix :) Doesn't seem like this is the case, so we may just want to delay this for 7.3. In any case, I've pushed up my latest fixes. For me, a URL of http://localhost:4000/dspace now works (in prod mode: yarn start) if I do the following:
However, Sitemaps don't seem to work at http://localhost:4000/dspace/sitemap_index.html, even though I've verified they work at http://localhost:8080/server/sitemaps/sitemap_index.html (as I have my frontend pointed at a local backend) |
|
Closing in favor of #1642 as that PR seems to be further along than this one (and I haven't had time to get back to this anyways) |
Replace mathjax pipe with directive

Description
This PR was inspired by a question on dspace-tech about running the UI on a subpath (i.e. http://localhost:4000/dspace/): https://groups.google.com/g/dspace-tech/c/YD5x0IGSuGc/m/D6GQcQUkBgAJ
When trying to answer that question, I discovered this isn't really possible because our base theme, and some images/fonts all assume you will run the UI on the root path (i.e. http://localhost:4000/)
This PR fixes those issues by ensuring all such paths are relative to the UI's deployment path.
Instructions for Reviewers
Should be tested in two ways (I've tested both and they work for me);
config.*.ymlto havenameSpace: /dspacein theuisection.index.htmlto have<base href="https://github.com/dspace/">here https://github.com/DSpace/dspace-angular/blob/main/src/index.html#L6index.csr.htmlto have<base href="https://github.com/dspace/">here https://github.com/DSpace/dspace-angular/blob/main/src/index.csr.html#L6