So I am testing deploying a luminus app behind nginx.
In my testing I am redirecting based on the location /udt
However when I go to server/udt I can see the page but the style sheet is not loading and on top of that going to any route under the home route breaks. Basically luminus does not understand the base url. I have tried setting the app_context env var in the systemd script but that seems to have done nothing. Nor can I come up with rewrite. Is there a way to alter the base url a luminus uberjar understands?
The fact that youâre using Luminus is mostly orthogonal to your server situation. Iâm guessing you are trying to deploy using java -jar? Yes, Iâve had lots of trouble working off of sub-paths, too. Simple solutions would be nice.
Yes that is the case, deploying the jar for now. I think deployed as a war in tomcat the solution is simpler. I have to test what I found on Monday when I get back to work, but if it is the correct solution I am going to make an end config file that will allow users to set sub path and port. I think that will make things easier for my target user base.
Thatâs the work around Iâve had; since I build SPAs, if Iâm going to be at a sub-directory I have the back-end provide a javascript âcontextâ var to the generated pages, which can be used to construct the right links. This was another of those, âIt works in dev⌠why not in prod?â issues I had. Mostly, though, I just use subdomain instead of subdirectory so I can avoid the problem. Easy fix if thatâs a possibility in your situation.
I am setting the handler-path based on an ini value I can see the web context, etc.
Nginx is redirecting to the location, but no permutation of root-url=/path or path or path/ or /path/ works. Only / works and then I have to have nginx listen on port 8080 to test that out. I have tried with and without url rewrite in nginx
From your original problem description, it seems to me like there might be a <base href="...â> missing in your HTML output. Itâll make all relative links/href/src URLs absolute, so a stylesheet with href="foo.css" will be prepended with the base URL.
That way, you also donât need to send a path to your script and manually construct URLs, as it can easily be done server-side (adding the base tag, that is).
AS a mention, first of all thank you for all the help. I am not done sorting this out but have sorted some things out and figured out the direction I need to take.
The real problems are around 2 things:
NGINX config is important, particularly how the location and the redirect are defined, particularly with regards to a trailing back slash. NGINX will use that as part of an auto url rewrite and I wasnât paying attention at my first go at setting that up.
I was looking for some pre-canned global place to do this. Like I was in rails or django. But luminus is a sane set of libraries and there are cases where if I want some central place to define things I need to define them. And that was me just not practicing the concepts correctly.
On a side note I am finding some interesting things with compile order of a luminus app in lein. Where things in handler and layout get evaluated before the core of the app. But I am dealing with that.