Can't run mealie on sub path of domain #695
Replies: 12 comments 8 replies
-
Did you mean to include something here after "root like:"? |
Beta Was this translation helpful? Give feedback.
-
Yes github stripped my text I think. |
Beta Was this translation helpful? Give feedback.
-
I've looked into implementing this and unfortunately I don't see a way to do it after the frontend is built for production. It should be easy enough to use an ENV on the backend side to set the base path for the API, I'm not sure how to set the Frontend to dynamically know where the "base path" would start. Hopefully someone else can chime in with a solution. |
Beta Was this translation helpful? Give feedback.
-
Minor Update - I've split the static files and the API with Caddy v2 in the dev branch. I'm not sure if that alone will suffice for getting everything working. But if additional Caddy configuration is needed I believe someone should be able to use env variables in the config to create user selectable base url. I don't have a ton of time/energy to dig too deep into this right now, but I'm hoping someone can bring this over the finish line. 👍 |
Beta Was this translation helpful? Give feedback.
-
Hi! I'm also looking at doing this. Would the ENV variable "BASE_URL" from mealie can be used for that? Thanks ! |
Beta Was this translation helpful? Give feedback.
-
wouldn't simply using ./api/ instead of /api/ in the production wouldn't be enough to allow the api to be accessible from any custom base url ? |
Beta Was this translation helpful? Give feedback.
-
I've tried that as well as a few other variations and it doesn't to work. The Vue router needs know what the base url is and as far a so can tell you can only set that during build time. |
Beta Was this translation helpful? Give feedback.
-
Hey, late to the party. Is there any way in the meantime or planned to support serving on a sub path? |
Beta Was this translation helpful? Give feedback.
-
Hello @hay-kot, @alexbelgium, I've been following your discussions about the dynamic sub-path config issue, and I wanted to suggest a potential solution. First, I wanted to confirm whether you're already considering nuxt/nuxt#8520 (added in Nuxt 2.15). I assume that Mealie's UI is statically generated, which makes that feature inapplicable. If that's the case, I'd like to propose an alternative method that I've successfully used in static apps:
With this setup, the app maintains its default behavior while allowing for a custom base path to be set at the proxy layer (like Nginx or Traefik) by mapping a specific |
Beta Was this translation helpful? Give feedback.
-
I believe I am having a related issue. Running mealie via docker and since the new update I have gotten unavailable messages whether trying to access my instance on local subnet (by xxx.xxx.xxx.xxx:9777) or through my reverse proxy/subdomain. |
Beta Was this translation helpful? Give feedback.
-
I have found a solution for how to set the SUB_PATH in your docker-compose file. The dockerfile needs to be tweaked, to accept the configuration from docker-compose, but only 2 lines need to be added and nothing else needs to be changed, I think this can be included in the official dockerfile ( FROM node:16 as builder
ARG SUB_PATH="" # assign a default, which will be used, if no arg is specified
ENV SUB_PATH=$SUB_PATH # this environment var will only exist during docker build time
WORKDIR /app
COPY ./frontend .
RUN yarn install \
--prefer-offline \
--frozen-lockfile \
--non-interactive \
--production=false \
# https://github.com/docker/build-push-action/issues/471
--network-timeout 1000000
RUN yarn generate
# the rest of the file remains unchanged ... And my configuration for the service in docker-compose looks like this: mealie-frontend:
build:
context: ./images/mealie/repo # this points from the docker-compose.yaml to the git repo root
dockerfile: docker/Dockerfile # the dockerfile modified like above, accepting args
args:
- SUB_PATH=/mealie/ # your desired subpath
tags:
- mealie-custom-subpath
restart: always
# etc. ... You need to launch docker compose with the |
Beta Was this translation helpful? Give feedback.
-
Ingress is implemented in my addon too now |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
It looks like I can't run mealie on a path in my domain (e.g. domain.com/mealie) since the html is served with paths pointing to the root like:
Steps To Reproduce
Please be specific!
Sample Code
Expected behavior
I would like to be able to pass a a path in via an environment variable, or
Actual Behavior
Blank home page
Screenshots
Device Information (please complete the following information):
Additional context
Beta Was this translation helpful? Give feedback.
All reactions