> For the complete documentation index, see [llms.txt](https://docs.uibakery.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uibakery.io/on-premise/networking-and-security/custom-base-url.md).

# Custom base URL

## **Docker Compose and** standalone NGINX

If you have set up your instance using **Docker Compose**, the easiest way to run UI Bakery under a base URL is to configure an NGINX server as a reverse proxy for your instance. The example below demonstrates how to run UI Bakery at `http://example.com/bakery`

### **1. Install NGINX**

```bash
sudo apt update
sudo apt install nginx
```

### **2. Create an NGINX configuration file**

Create an NGINX configuration file at `/etc/nginx/sites-enabled/example.com` with the following content:

```nginx
server {
  listen 80;
  listen [::]:80;
  server_name example.com;
  client_max_body_size 50M;
  
    location /bakery {
      rewrite /bakery/(.+) /$1 break;
      proxy_pass http://localhost:3030;
    }
}

```

### **3. Update environment variables**

Update the following UI Bakery environment variables:

```bash
UI_BAKERY_APP_SERVER_NAME=http://example.com/bakery
UI_BAKERY_BASE_PATH=/bakery/
UI_BAKERY_WORKBENCH_URL=/bakery/workbench/
UI_BAKERY_WORKBENCH_BASE_PATH=/bakery/workbench/
```

### **4. Restart UI Bakery and NGINX**

After updating the configuration and environment variables, restart NGINX and UI Bakery:

```bash
# restart nginx
sudo systemctl reload nginx
# restart ui bakery
docker compose up -d
```

## Kubernetes

If you're already running UI Bakery on Kubernetes and want to relocate it under a specific path, such as `/bakery`, follow these steps:

### **1. Modify gateway configuration file**

Update your `ui-bakery-gateway.yaml` file. Change the `spec` type from `LoadBalancer` to `ClusterIP`

### **2. Add ingress-nginx**

Install `ingress-nginx` using Helm:

```
helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ui-bakery
```

### **3. Create UI Bakery ingress configuration**

Create a `ui-bakery-ingress.yaml` configuration file with the following content:

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ui-bakery-ingress
  namespace: ui-bakery
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/use-regex: "true"
    nginx.ingress.kubernetes.io/configuration-snippet: |
      rewrite /bakery/(.+) /$1 break;
spec:
  ingressClassName: nginx
  rules:
  - http:
      paths:
      - path: /bakery
        pathType: ImplementationSpecific
        backend:
          service:
            name: bakery-gateway
            port:
              number: 3030
```

### **4. Update UI Bakery config**

Adjust the following UI Bakery environment variables:

```yaml
UI_BAKERY_APP_SERVER_NAME: https://example.com/bakery
UI_BAKERY_BASE_PATH: /bakery/
UI_BAKERY_WORKBENCH_URL: /bakery/workbench/
UI_BAKERY_WORKBENCH_BASE_PATH: /bakery/workbench/
```

### **5. Restart your instance**

Apply changes with:

```bash
kubectl apply -f .
# you may need to restart frontend
kubectl rollout restart deployment/ui-bakery-front --namespace=ui-bakery
kubectl rollout restart deployment/ui-bakery-workbench-front --namespace=ui-bakery
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.uibakery.io/on-premise/networking-and-security/custom-base-url.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
