A web-application setup using a CouchDB database is giving me a headache. The issue seems to be, that the document ID's contain special characters as "/", "-" or spaces. Here is an example URL (encoded)
http://127.0.0.1:5984/procedures/1%2F1%2F1143%2F1%2Fschwer%2F1%2F0.0%2F1.3
The CouchDB is configured with nginx as a reverse proxy, so http://127.0.0.1:5984/ is available at https://example.com/db
The problem now is that when using standard procedures, nginx seems to decode the URL during a rewrite, but then not encode it again.
We have come up with the following location setup in nginx to overcome the issue:
location /db {
set $modified_uri $request_uri;
if ($modified_uri ~ "^(.{3})(.*)") {
set $modified_uri $2;
}
proxy_pass http://127.0.0.1:5984$modified_uri;
}
However now, a slash "/" is encoded with '%252F' instead of '%2F'. Does anyone have an idea on how to fix this issue? Thanks a lot!