Feat: Allow web interface to serve content behind an optional URL path prefix#1124
Feat: Allow web interface to serve content behind an optional URL path prefix#1124ngearhart wants to merge 2 commits intoneuvector:mainfrom
Conversation
…path prefix Signed-off-by: Noah Gearhart <noah.gearhart@darkwolfsolutions.com>
Signed-off-by: Noah Gearhart <noah.gearhart@darkwolfsolutions.com>
|
I want to add that I am not married to the environment variable being named |
|
I am the other person ngearhart was talking about. My suggestion was BASE_PATH. And there are other alternatives like RELATIVE_PATH, etc. Just depends on what the reviewers prefer. |
xingzhang-suse
left a comment
There was a problem hiding this comment.
I have a discussion comment to you.
As this PR is valid case according to PM's confirmation, we will merge it in the next release.
Could you please confirm my question? Thank you!
| val rawPathOption: Option[String] = sys.env.get("PATH_PREFIX") | ||
|
|
||
| rawPathOption match { | ||
| case Some(value) => "/" + value.trim |
There was a problem hiding this comment.
Should the value be escaped before it append to the URL?
There was a problem hiding this comment.
Yes, it should. Let me make that change and get back to you.
The Neuvector UI (manager) requires all traffic to be hosted at the root URL behind an FQDN. Although this fits most deployment scenarios, some users (me included) need to route traffic based on URL path prefixes. For example, instead of hosting at "https://neuvector.example.com/", I use "https://example.com/neuvector/".
This PR adds the necessary scaffolding to support a path prefix as described using the optional
PATH_PREFIXenvironment variable. If unset, the Neuvector manager will continue to work as previous, serving at the root URL.This environment variable must not contain a preceding slash.
To test, simply set the environment variable in your environment, and navigate to that new path (for example, if you usually navigate to
http://localhost:8443, set the var totest-pathand navigate tohttp://localhost:8443/test-path/).