opendatateam/udata

Automatic URL considered as invalid when creating ressource on local instance (http://127.0.0.1:7000)

Opened this issue · 3 comments

I'm testing udata with local docker stack
The domain name is so http://127.0.0.0.1:7000

When I try to create a new dataset for testing, I can't validate the ressource (CSV upload) because the URL that is generated is concidered as invalid
URL : http://127.0.0.1:7000/en/admin/dataset/new/
URL auto generated: http://127.0.0.1:7000/s/resources/dataset1/20240718-053900/ports.csv

Error message on URL field: Please enter a valid URL

Detailed Description

I've started from scrach a docker instance on local dev plateform
I've created an organsiation
when I try to create a new dataset based on a CSV, on the page asking to upload the file, I'm stuck with the error "Please enter a valid URL" for the resource, but no way to bypass as the field is read only
So finally I can't really test the dev instance

Context

The criterias of what is a valid URL is not given in question mark
Mayeb it is due to domain format nom:port or maybe it is due to presence of IP adress, or maybe 127.0.0.1
If it is, so this should be present in pre-requisite for mounting an instance
Or be more tolerant on domain name

Possible Implementation

Your Environment

This is docker stack based on podman
I'm on Windows 10 entreprise

  • Browser Name and version: Firefox 115.11.0esr (64 bits)
  • Operating System and version (desktop or mobile): desktop

Capture

Thank you for your ticket.

I think some configurations are needed in your udata.cfg to make it work with local URLs.
See this udata.cfg sample, with some properties that may be related with your issue:

URLS_ALLOW_LOCAL = True
URLS_ALLOWED_TLDS = Defaults.URLS_ALLOWED_TLDS | set(['local'])

RESOURCES_FILE_ALLOWED_DOMAINS = ['*']

I would also recommend using the dev.local:7000 URL locally as described in this documentation.

You may see more logs on the udata server backend?

Thank you for the rapid answer
This configuration should solve my problem ! "RTFM"
For dns dev.local solution, basically I've not the permissions to edit hosts file on my machine

So I checked. in fact it was already the configuration values I'm using as I followed the at first try
The only thing I can't do to follow completly the recommandations with my machine is to edit the domain name in etc/hosts to get dev.local:7000 but I tried with http://localhost:7000 and the result is the same. I'm on windows on professional computer and I'm not admin user
I tried with ports 80:7000 and http://localhost/... without port, this is the same invalid error message so this is not due to the host:port format
I tried with adding explicitly URLS_ALLOWED_SCHEMES=('http', 'https', 'ftp', 'ftps'), same error
I tried URLS_ALLOWED_TLDS = Defaults.URLS_ALLOWED_TLDS | set(['localhost']), same error