Baserow 1.16 and FlutterFlow - CORS policy in API calls

Hello,

I’can request anymore Baserow API from FlutterFlow since I’ve upgraded to 1.16 and raise a CORS policy error.

I found this usefull post about CORS, but don’t know where to set it up.

Does anyone know how to do that in baserow ?

Thanks,

The error :

Acess to XMLHttpRequest at 'https://XXXXXX/api/database/rows/table/23/?user_field_names=true&filter__field_277__equal=XXXXXX@gmail.com' 
from origin 'https://XXXXXX.flutterflow.app' has been blocked by CORS policy: 
Request header field charset is not allowed by Access-Control-Allow-Headers in preflight response.

The request details :

URL de requête: https://XXXX/api/database/rows/table/23/?user_field_names=true&filter__field_277__equal=XXX@gmail.com
Règlement sur les URL de provenance: strict-origin-when-cross-origin
En-têtes provisoires affichés
Authorization: Token XXXXXXXXXXXXX
charset: utf-8
Content-Type: application/json
Referer: https://XXXX.flutterflow.app/
sec-ch-ua: "Chromium";v="112", "Google Chrome";v="112", "Not:A-Brand";v="99"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "macOS"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) 

Baserow is selfhosted with a docker on OVH launched with

docker run \
  -d \
  --name baserow \
  -e BASEROW_PUBLIC_URL=https://XXXXXXXXXX \
  -e BASEROW_CADDY_ADDRESSES=https://XXXXXXXXXX\
  -e DATABASE_HOST=postgresql-XXXXXXXXXX.database.cloud.ovh.net \
  -e DATABASE_NAME=XXXXXXXXXX \
  -e DATABASE_USER=XXXXXXXXXX \
  -e DATABASE_PASSWORD=XXXXXXXXXX \
  -e DATABASE_PORT=20184 \
  -e EMAIL_SMTP='TRUE' \
  -e EMAIL_SMTP_HOST='smtp.gmail.com' \
  -e EMAIL_SMTP_PORT='587' \
  -e EMAIL_SMTP_USER='XXXXXXXXXX@gmail.com' \
  -e EMAIL_SMTP_PASSWORD='XXXXXXXXXX' \
  -e EMAIL_SMTP_USE_TLS='TRUE' \
  -e FROM_EMAIL='XXXXXXXXXX@gmail.com' \
  -e HOURS_UNTIL_TRASH_PERMANENTLY_DELETED=720 \
  -e BASEROW_TRIGGER_SYNC_TEMPLATES_AFTER_MIGRATION=false \
  -e BASEROW_ROW_PAGE_SIZE_LIMIT=5000\
  -v baserow_data:/baserow/data \
  -p 80:80 \
  -p 443:443 \
  --restart unless-stopped \
  baserow/baserow:1.16.0

@Clapp The error indicates that Baserow is not accepting your requests, because of your charset header on the request you are sending to Baserow.

From a brief look at the code it looks like Baserow has never allowed cross origin requests with the charset header.

Is it possible that your FlutterFlow setup has changed and is now sending this charset header? I do not believe this is a valid HTTP standard header. Instead if you need to specify a charset you should be including it in the Content-Type header Content-Type - HTTP | MDN

1 Like

:pray::pray:

My bad! charset was one on my useless addition to the request haha

Thank you for your quick reply @nigel