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

[Bug]: Custom Proxy Base Url not working #5997

Open
DanielOtter opened this issue Oct 1, 2024 · 10 comments
Open

[Bug]: Custom Proxy Base Url not working #5997

DanielOtter opened this issue Oct 1, 2024 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@DanielOtter
Copy link

DanielOtter commented Oct 1, 2024

What happened?

I was trying to deploy litellm with custom proxy base url settings but get requests of /sso and /ui do not append the base url and call the wrong urls. Since I am using a url map in my setup to redirect requests with different base urls to their respective services, these requests go to the void.

I followed the docs and built my image with a slightly edited Dockerfile:

# Use the provided base image
FROM ghcr.io/berriai/litellm:litellm_fwd_server_root_path-dev

# Set the working directory to /app
WORKDIR /app

# Install Node.js and npm (adjust version as needed)
RUN apt-get update && apt-get install -y nodejs npm

# Copy the UI source into the container
COPY ./ui/litellm-dashboard /app/ui/litellm-dashboard

# Set an environment variable for UI_BASE_PATH
# This can be overridden at build time
# set UI_BASE_PATH to "<your server root path>/ui"
ENV UI_BASE_PATH="/litellm/ui"

# Build the UI with the specified UI_BASE_PATH
WORKDIR /app/ui/litellm-dashboard
RUN npm install
RUN UI_BASE_PATH=$UI_BASE_PATH npm run build

# Create the destination directory
RUN mkdir -p /app/litellm/proxy/_experimental/out

# Move the built files to the appropriate location
# Assuming the build output is in ./out directory
RUN rm -rf /app/litellm/proxy/_experimental/out/* && \
    mv ./out/* /app/litellm/proxy/_experimental/out/

# Switch back to the main app directory
WORKDIR /app
RUN pip install prisma 
RUN prisma generate

RUN chmod +x entrypoint.sh

COPY config.yaml config.yaml

EXPOSE 8080/tcp

ENTRYPOINT ["litellm"]
CMD ["--port", "8080", "--config", "config.yaml"]

The environment variable of the running container is set to:
SERVER_ROOT_PATH="/litellm"

Relevant log output

[01/Oct/2024:13:18:29 +0000] "GET /ui/favicon.ico HTTP/1.1" 200 944 "https://placeholderdomain.com/litellm/ui/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"

Twitter / LinkedIn details

No response

@DanielOtter DanielOtter added the bug Something isn't working label Oct 1, 2024
@krrishdholakia
Copy link
Contributor

cc: @ishaan-jaff - i think you have more context on custom base url's

@max0uuuu
Copy link

I think I have the same issue

@ma-armenta
Copy link

I noticed this too. By reading source code, python code has multiple locations where /ui is hardcoded as the dashboard ui path.

@ishaan-jaff, I can look into it.

@ishaan-jaff
Copy link
Contributor

that would be great- can you add testing + tag me on the PR @ma-armenta

@DanielOtter
Copy link
Author

Hi, has there been progress with this issue. Is there any way I can assist?

@Jflick58
Copy link

@DanielOtter can you provide more info for your build flow? I'm running into issues with this as reported in #7318

@DanielOtter
Copy link
Author

Well, it has been a few months, but basically, like I have said, I followed the guide in the documentation and set the UI_BASE_PATH in my dockerfile. Then I created a docker image with it and ran it with the environment variable SERVER_ROOT_PATH. What specifically do you want to know about the build flow?

In one of my projects several generic paths are already in use like for example /ui, that is why I wanted to change the path. And that is how I noticed quickly that something was wrong, when traffic was not going through the right endpoints.

@DanielOtter
Copy link
Author

@Jflick58 If you look at my Dockerfile in my description of the issue the documentation then mentioned a specific base image: ghcr.io/berriai/litellm:litellm_fwd_server_root_path-dev. I have seen your issue, maybe the silent change to the main image introduced this bug.

@Jflick58
Copy link

Do you know what version you built off of?

@DanielOtter
Copy link
Author

ghcr.io/berriai/litellm:litellm_fwd_server_root_path-dev refers to version 1.40.3 I think, while the actual version I was trying to build was 1.48.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants