Usefulness of `self_link` in REST API responses
So, this comes after a long headache of why something obvious wasn't working when I was trying to deploy the mailman. The issue being when I ran the mailman core I used the following (relevant) configuration:
[webservice]
hostname: 0.0.0.0
This was so because I was deploying in a docker-container and didn't care what hostname was given to the container. Now, in another container I tried running postorius. But as soon as I would create a Domain, I would get a MailmanConnectionError
which meant that postorius wasn't able to get to the core's REST API, which I knew for a fact was working/running properly. So, I tried out using the API using curl and got the following response for /domains/
{
"entries": [
{
"description": "First mailman list.",
"http_etag": "\"22b73b0e2235d711e3045613410e7fc3085515f1\"",
"mail_host": "mail.araj.me",
"self_link": "http://0.0.0.0:8001/3.1/domains/mail.araj.me"
}
],
"http_etag": "\"6429ae1bad947edd484270b8ef7aea3b88f7c952\"",
"start": 0,
"total_size": 1
}
Then it hit me that self_link
is malformed and if client tries to access that URL, it would most definitely hit an error.
I don't know if using 0.0.0.0
is something wrong/uncommon to listen a server on, so I wanted to hear what others have to say on this.
Maybe we could just return a relative link in self_link
and join with the already existing base_url for the API that client already knows about?