Skip to content
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

Fix relative paths #251

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

jfstenuit
Copy link

Changes to allow running eml_analyzer from a sub-path, for instance lab.company.com/eml_analyzer/

Requires setting up a reverse proxy and a matching setting in VITE_BASE_PATH environment variable.

Fix relative paths in index.html
Fix relative path in vite config
Fix relative paths in api.ts
@jfstenuit jfstenuit mentioned this pull request Feb 27, 2025
@ninoseki
Copy link
Owner

ninoseki commented Feb 28, 2025

I understand your pain point but I don't want to make this app complicated to support sub-path/directory.
I recommend you to use reverse proxy or why don't you use subdoman like eml-analyzer.lab.company.com?

@jfstenuit
Copy link
Author

Actually, the changes in this PR are done to enable the good working of the application behind a reverse proxy.

Configuration of NginX reverse proxy :

server {
        listen            443 ssl http2;
        listen            [::]:443 ssl http2;
...
        location /eml_analyzer/ {
                proxy_pass        http://192.168.0.193:5173;
        }
}

It doesn't get more complex than those 11 lines changed in the PR. The rest is automatically taken into account by vite. All the contributors can keep on improving the project without changing anything in their way of working.

Without the changes in this PR, the reverse proxy configuration above fails because eml_analyzer returns HTML/JS/CSS code that refers to the root of the URL. As responses are not altered by the reverse proxy, this cause the application to fail.

See that part of the doc for details : https://vite.dev/config/shared-options.html#base

@ninoseki
Copy link
Owner

Hmm okay but what do you think about subdomain option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants