Anvil App Server behind reverse proxy on subpath

I am trying to put my anvil apps behind my nginx reverse proxy. I have been able to make this work with a subdomain, but would like to use subpaths instead.

I am running multiple anvil apps and would like to put them on subpaths so I don’t have to create a separate subdomain for each.

Does anybody have any ideas how I might achieve this?

Cheers

Do you want to access the apps like this?
App 1:
Public url: https://app1.mydomain.com
Internal url: http://192.168.1.10:3000

App 2:
Public url: https://app2.mydomain.com
Internal url: http://192.168.1.20:3000

I have one of my apps running as a docker container in CasaOS

This is my yaml file


name: pensive_driscoll
services:
  pensive_driscoll:
    cpu_shares: 90
    command:
      - --app
      - MainApp
      - --disable-tls
      - --ip
      - 0.0.0.0
      - --port
      - "3030"
      - --origin
      - https://portal.carlbomsdata.se
    deploy:
      resources:
        limits:
          memory: 2048M
    environment:
      - PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/0d8570dc44796f4369b652222cf176b3db6ac70e/public/get-pip.py
      - PYTHON_PIP_VERSION=23.1.2
      - PYTHON_SETUPTOOLS_VERSION=65.5.1
      - PYTHON_VERSION=3.11.4
    image: anvilworks/anvil-app-server:latest
    ports:
      - target: 3030
        published: "3030"
        protocol: tcp
    privileged: true
    restart: unless-stopped
    volumes:
      - type: bind
        source: /anvil_app/CarlbomsDataPortal
        target: /apps/MainApp
      - type: bind
        source: /anvil_app/.anvil-data
        target: /anvil-data
    x-casaos:
      envs:
        - container: PATH
          description:
            en_us: ""
        - container: LANG
          description:
            en_us: ""
        - container: GPG_KEY
          description:
            en_us: ""
        - container: PYTHON_VERSION
          description:
            en_us: ""
        - container: PYTHON_PIP_VERSION
          description:
            en_us: ""
        - container: PYTHON_SETUPTOOLS_VERSION
          description:
            en_us: ""
        - container: PYTHON_GET_PIP_URL
          description:
            en_us: ""
        - container: PYTHON_GET_PIP_SHA256
          description:
            en_us: ""
      image: ""
      ports:
        - container: "3030"
          description:
            en_us: ""
      volumes:
        - container: /apps/MainApp
          description:
            en_us: ""
        - container: /anvil-data
          description:
            en_us: ""
    devices: []
    cap_add: []
    network_mode: default
    container_name: ""
    hostname: ""
x-casaos:
  architectures:
    - amd64
  author: CasaOS User
  category: unknown
  description:
    en_us: ""
  developer: unknown
  hostname: ""
  icon: ""
  image: null
  index: /
  is_uncontrolled: false
  main: pensive_driscoll
  port_map: "3030"
  scheme: http
  store_app_id: pensive_driscoll
  tagline:
    en_us: This is a compose app converted from a legacy app (CasaOS v0.4.3 or
      earlier)
  thumbnail: ""
  tips:
    custom: This is a compose app converted from a legacy app (CasaOS v0.4.3 or
      earlier)
  title:
    custom: ""
    en_us: anvil001


This is my reverse proxy settings on my Synology NAS:


In my router I have a port forward for 443 which points to my Synology NAS (100.0.0.10)

As I have understand. The argument —ip 0.0.0.0 is important (to make app accessible within LAN) and also —orgin https://xyz.mydomain.com (it’s important that this matches the reverse proxy domain otherwise anvil will through errors)

2 Likes

No. I already have my nginx setup to make this work. I want to remove the need for additional subdomains for each app all-together.
So apps are accessed via:
App1: https://mydomain.com/app1
App2: https://mydomain.com/app2

Hi @bohdan,

I’m afraid there is no way to do this with Anvil. All apps must have their own domains or subdomains in order to benefit from cross-domain isolation provided by browsers.

1 Like

I’m not looking to do this but I’m curious - isn’t “anvil.works/build” an Anvil app hosted on a subpath? Or am I mistaken