You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2021/08/11 06:51:16 UTC
[GitHub] [couchdb-documentation] m90 opened a new issue #675: Reverse Proxying CouchDB in a subdirectory with nginx example does not handle URL encoded path fragments
m90 opened a new issue #675:
URL: https://github.com/apache/couchdb-documentation/issues/675
<!--- Provide a general summary of the issue in the Title above -->
## Expected Behavior
Using the rewrite setup described in https://docs.couchdb.org/en/stable/best-practices/reverse-proxies.html#reverse-proxying-couchdb-in-a-subdirectory-with-nginx I would expect nginx to pass my path parameters 1:1.
E.g. I request:
```
"GET /couchdb/_users/org.couchdb.user%foo.bar%2Btest8%40example.com?conflicts=true"
```
and the request that CouchDB sees ist:
```
"GET /_users/org.couchdb.user%foo.bar%2Btest8%40example.com?conflicts=true"
```
## Current Behavior
Using the documented rewrite rules, nginx decodes the path parameters, which means it sees this instead:
```
"GET /_users/org.couchdb.user:foo.bar+test8@example.com?conflicts=true"
```
which makes CouchDB return 404 (I would assume this is because of the `+`).
## Possible Solution
Instead, the following rewrite rules can be used:
```
location /couchdb {
rewrite ^ $request_uri;
rewrite ^/couchdb/(.*) /$1 break;
proxy_pass http://localhost:5984$uri;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
```
## Steps to Reproduce (for bugs)
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->
1. Create user doc whose id contains a `+`
2. Use the reverse proxy setup in a subdirectory as described in the docs
3. GET the user doc
4. 404 response
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org