-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "base_url" option, to "up()" to lop off referrer route path sent in from proxy servers (e.g. nginx)? #663
Comments
If I correctly understand the use case, what you are looking for is |
Thanks for the response! That certainly looks like the setting I'm interested in. Also, the API docs don't seem to include the kwargs (and the "code" link doesn't seem to point to any code") I thought I recalled some documentation (in a tutorial video?) about configuration, somewhere, but then wondered if it was in your very nice book: "Web Development with Julia and Genie" I'll give it a try, and report back, when I get a chance. |
The good news is that, with host = "0.0.0.0", etc., the request does seem to be getting to the node running the Genie server. The bad news is that the Genie.config.base_path setting seems to have no effect, as Genie serves a 404, on that route. julia> Genie.config.base_path
"/node/<hostname>/8000" 404 Not Found That's the exact same response as I get when I . . . julia> Genie.config.base_path = ""
"" |
Looking at code like the following . . . Line 395 in 7fe0529
. . . I wonder if this is actually the type of setting I'm looking for. That seems to be adding the base_path. Maybe I simply need to make sure all routes have that prefix added to them, by setting a const variable and adding to each one. Taking a look at . . . I guess, either way, the route will get a name (but stable, if I assign it myself). But maybe the recommended pattern is to always build up routes via linkto(). e.g. I guess I can learn by looking at some example web apps, maybe. But I guess I'm still confused. Shouldn't the default up() command already be using the linkto command, incorporating the set config.base_path, whenever it resolves a route? |
This function signature doesn't look right, to me. How can one assign to a default (. . . = basepath) which doesn't seem to be defined (except maybe globally, by accident)? Line 392 in 7fe0529
I'm just wondering if that to_link() does end up being called directly, in most cases (to resolve routes). But it then it has no knowledge of Line 446 in 7fe0529
? Hmmm . . . I did not realize it was possible to assign to something undefined, in Julia. julia> dumbfunc(arg1 = bob) = "$arg1 is dumb."
dumbfunc (generic function with 2 methods)
julia> bob
ERROR: UndefVarError: `bob` not defined Perhaps that is allowed, to enable things to work if/when a symbol does come into scope. Anyway, I don't see a basepath symbol in the Genie code, unless you bring the basepath function, under Configuration.jl, into scope. |
I wonder if it wouldn't be better to handle the Line 147 in 7fe0529
. . . or maybe pushed down into . . . Lines 485 to 486 in 7fe0529
. . . rather than having it only handled/called when Because I can get my use case to work by . . . julia> route(Genie.config.base_path, named=:web_root) do
"Hello Web Root"
end But then . . . julia> linkto(:web_root)
"/node/<hostname>/8000/node/<hostname>/8000" . . . or is another way recommended? Can I use something like ":web_root" as a route? -or get_route().action() in a new route? |
Related issue: GenieFramework/GenieFramework.jl#10 |
Thanks for creating Genie!!! It is very nicely designed and full-featured.
I apologize in advance if this is already (better) handled another way, which I may have missed (maybe there are already parameters which can be passed through to HTTP.jl, or something?)
We have a setup whereby certain routes (handled by an nginx proxy server) can lead to ad-hoc services on cluster node routes (/node//).
Users can, for example, get a slurm allocation to run a Jupyter Lab session. But the proxy server seems to pass the entire ref url path to the listener service. Jupyter Lab has a "base_url" config parameter to deal with this (Jupyter server not knowing anything about the added route path).
The Pluto.jl folks were nice enough to add that to the "Pluto.run()" command.
fonsp/Pluto.jl#2225
fonsp/Pluto.jl@22be5d0
Is this something which might makes sense to add?
I am considering using Genie to spin up on-demand interactive presentation pages, maybe from some base/stock/template web app.
Thanks!
The text was updated successfully, but these errors were encountered: