-
-
Notifications
You must be signed in to change notification settings - Fork 6
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 a customized base URL in the configuration through an environment variable #516
Comments
Hi, so vite is responsible only for dev run, as I understand you talk about providing this base url inside the docker and then Ivory to work under this url. The problem is that under the hood it builds files and then locate them inside the docker then this is nginx who is responsible for directing you to these files or backend API https://github.com/veegres/ivory/blob/master/docker/production/nginx.conf. Tbh I'm not sure that this is really a good idea, and use case is not really clear for me, probably you need to configure your DNS or your proxy. For example at my work we have haproxy that routes |
In which case, both Nginx and the website frontend itself should apply this base URL configuration. It's actually a good idea to provide such a feature though. I mean, ones can possibly want to make all their HA monitoring stuff, including dashboards like Ivory, under the same domain name, like In this way, their coworkers can access different services by However, if a base URL, Thus, although it's not necessary, it's helpful to allow a customized base URL. Btw, since you have mentioned Nginx, I think another feature allowing https traffic with TLS certificates can also be helpful. Should I open another issue about it? |
I'm not really good at reverse proxies, but I though that in your proxy (HAProxy, Nginx, etc) you can configure desired url like
yeah, I thought about adding tls for Ivory, you can create a task of course, but for now solution is to hide your proxy under TLS and direct this proxy to Ivory. You don't have safety between proxy and Ivory, but at least you will have safety between client and proxy (this is how I use it right now, but of course some day it should be added). If you good at configuring Nginx and it certs feel free to contribute :) It shouldn't be hard, but require some knowledge that I need to investigate, that is why it is not supported yet. |
I'm not a frontend guy, so my explanation could be faulty, but I'll try my best to explain the problem.
Like I said, that's not gonna work. At lease not how the frontend framework works.
Take a look at web/index.html, and you can see why. <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<link rel="icon" href="/ivory-fav.png"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="/manifest.json"/>
<title>Ivory</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script type="module" src="/src/app/main/index.tsx"></script>
</body>
</html> As you can see, all static files are repuested under the What's worse, if there are only some of these pictures or files missing, the website can still work, but no, the real html in the production environment the browsers get from your frontend will include something like <head>
...
<script type="module" crossorigin src="/assets/index-Cv0uEsfF.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CFMAGa7F.css">
...
</head> to introduce all you have done in the rest of the frontend programs (The suffices of them here may change). Still, since Ivory is running under In conclusion, even though your users know they should get Ivory under P.S. You can see all of what browsers asking in the Network tab of the developer tools by pressing F12 when connecting to the webpage. |
ok, probably I should recheck this, after you mentioned these static files, maybe you're right, so I will do it and share what I will get |
I think I fully solved this. Please check #529 🙏. |
vite.config
through an environment variable
Please, test version |
OK, I get it. You decided to use the server directly to serve these files. It's a brilliant idea! |
Am I right, that your solution works only with additional With current implement it should work with and without it. P.S. I've created task for TLS #531 (comment) |
I guess it depends on what
If nothing is given, the solution will skip the first two steps and replace If no slash is given, the solution will
A leading backslash is there since it was originally added to make If a trailing slash is given, the solution will
The first step will make the redirection break, so the request path of the website must be So, I guess yeah, I'm glad that there is a more flexible solution. Thus, if the slash you meant is the leading slash, the answer is yes. If the slash it the trailing slash, the answer is no. There must not be a trailing slash. |
Is your feature request related to a problem? Please describe.
Ivory now uses
/
as its base URL as default. Allowing users to change this when building Ivory withdocker run -e
can let Ivory become more flexible when being deployed alongside other services and accessed through a reverse proxy.Describe the solution you'd like
I think adding the
base
option invite.config
withprocess.env
can achieve this, but still an integration test should be conducted in case that this isn't compatible with the current Ivory program. A default value should also be assigned in case that users didn't provide a value.Describe alternatives you've considered
Adding the
--base
option tovite build
should also be able to achieve the same goal.Additional context
ref
The text was updated successfully, but these errors were encountered: