Access Baserow API from different service running via docker-compose

Hi,
I would like to ask for help with accessing baserow API from another service running via docker-compose when public port is different.

I have node-red and baserow where I changed baserow port from 80 to 1888.
The node-red service is not able to access the baserow API.

curl --location 'http://baserow/api/database/rows/table/531/?user_field_names=true' \
--header 'Authorization: Token TOKEN'

Error:
Site not found // Baserow

From host system it all works as expected with:

curl --location 'http://localhost:1888/api/database/rows/table/531/?user_field_names=true' \
--header 'Authorization: Token TOKEN'

Any idea where I need to adjust setting?
Thank you

my docker-compose.yaml

version: "3.7"

services:
  node-red:
    image: nodered/node-red:latest
    environment:
      - TZ=Australia/Brisbane
    ports:
      - "1880:1880"
    networks:
      - node-red-net
    volumes:
      - node-red-data:/data

  baserow:
    container_name: baserow
    image: baserow/baserow:1.23.2
    environment:
      BASEROW_PUBLIC_URL: 'http://localhost:1888'
      WEB_FRONTEND_PORT: 1888
      BASEROW_EXTRA_ALLOWED_HOSTS: 'baserow'
    ports:
      - "1888:80"
      - "443:443"
    networks:
      - node-red-net
    volumes:
      - baserow_data:/baserow/data

volumes:
  node-red-data:
  baserow_data:

networks:
  node-red-net:

Hi!

Could you set BASEROW_PUBLIC_URL to http://baserow:1888 ?

It’s currently not possible to access Baserow via another URL than the configured BASEROW_PUBLIC_URL in the all-in-one image (baserow/baserow). This is because of the application builder included in Baserow, and the feature where you deploy it to multiple domains. I’ve created an issue on the backlog to make this more flexible: Allow setting multiple BASEROW_PUBLIC_URL (#2499) · Issues · Baserow / baserow · GitLab.

I will try that and set host DNS “baserow” as 127.0.0.1

Will post, the outcome

1 Like

Thank you for answering. It helps put some confidence in the grey matter between my ears.
And thank you for creating a issue for new feature.

I felt, I have spent too much time on this, without doing something silly.

1 Like

It don’t works to me. I also spent a long time trying. Now i will launch other docker container to access the localhost of Windows host. I need to call api requests from Django.

I tried to change it as @cezary suggested with same result.

At least it is clear now, that it is not possible at the moment.
Thank you all for suggestions and replies.

Hi! I solved the problem!

First, you need download the files from this link ( Install with Docker compose // Baserow) and edit the docker compose including your service (i included ubuntu image). The curl command should to be:

curl -X GET -H “Authorization: Token HlEBegmSnfnqrYERQvwu06cq2paSJgRv” “http://backend:8000/api/database/rows/table/83/”

It worked to me!

Thank you for sharing the solution that worked for you, @fpgdesa.

1 Like

Hi, could you share more details on what got changed compared to the default docker-compose.yml config for Baserow?

I have been trying for a couple of hours to make Baserow’s API accessible from n8n (from within the same container, hosted locally) and either the Web App is working and the API throws an error page (with BASEROW_PUBLIC_URL set to localhost:8000) or the opposite is true - for BASEROW_PUBLIC_URL set to baserow:8000.

In the 1st scenario, Baserow’s API is accessible from curl, but can’t be reached from within the docker container.

Hi, could you share more details on what got changed compared to the default docker-compose.yml config for Baserow?

I have been trying for a couple of hours to make Baserow’s API accessible from n8n (from within the same container, hosted locally) and either the Web App is working and the API throws an error page (with BASEROW_PUBLIC_URL set to localhost:8000) or the opposite is true - for BASEROW_PUBLIC_URL set to baserow:8000.

In the 1st scenario, Baserow’s API is accessible from curl, but can’t be reached from within the docker container.

Just a note here: this question was asked and answered here: Problem with accessing Baserow’s API from within a docker container - #5 by michal.platek

1 Like