You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "key262yek (via GitHub)" <gi...@apache.org> on 2024/03/01 11:11:33 UTC

[I] Change port not working for reverse proxy [couchdb-docker]

key262yek opened a new issue, #254:
URL: https://github.com/apache/couchdb-docker/issues/254

   <!-- STOP! If this is a CouchDB-specific issue - unrelated to running CouchDB
        in Docker, file your issue here: https://github.com/apache/couchdb/issues 
        instead!
   
        This repository is only for CouchDB *Docker* specific issues. -->
   
   <!--- Provide a general summary of the issue in the Title above -->
   I setup couchdb via rootless docker on Ubuntu 22.04, docker v25.0.3
   with following compose 
   
   ```yaml
   couchdb:
       image: couchdb:3.3.3
       container_name: couchdb
       restart: unless-stopped
       ports:
         - "9564:5984"
       networks:
         - monitoring
       environment:
         - COUCHDB_USER
         - COUCHDB_PASSWORD
       volumes:
         - couchdb_data:/opt/couchdb/data    
         - ./couchdb/local.ini:/opt/couchdb/etc/local.ini
   ```
   As you can see, I change the port from 5984 to other. 
   It runs fine, and I can access Fauxton via http://localhost:9564/_utils
   
   Since I want to reverse proxy db, I wrote haproxy.cfg 
   
   ```
   backend couchdb-http
           mode http
           balance roundrobin
           option httpchk GET /_up
           http-check disable-on-404
           server couchdb localhost:9564 check inter 5s
           timeout connect 4s
           timeout server 4s
   
   frontend redirect
           mode http
           bind :::80 v4v6
           bind :::443 v4v6 ssl crt /etc/haproxy/certs/domain.pem
   
           http-request redirect scheme https code 301 unless { ssl_fc }
           http-response set-header Strict-Transport-Security "max-age=16000000; includeSubDomains; preload;"
   
           http-request set-header Host %[req.hdr(Host)]
           http-request set-header X-Forwarded-Proto https if { ssl_fc }
   
           use_backend couchdb-http
   
           timeout client 4s
   ```
   But it fails with error `couchdb-http/couchdb is DOWN, reason: Layer7 wrong status, code: 401, info: "Unauthorized"`
   
   If I change the port in backend from 9564 to 5984, it works. 
   
   ## Expected Behavior
   <!--- If you're describing a bug, tell us what should happen -->
   Reverse proxy works with port 9564
   <!--- If you're suggesting a change/improvement, tell us how it should work -->
   
   ## Current Behavior
   <!--- If describing a bug, tell us what happens instead of the expected behavior -->
   Reverse proxy works only with port 5984 even if I changed port in compose.yaml
   <!--- If suggesting a change/improvement, explain the difference from current behavior -->
   
   ## Possible Solution
   <!--- Not obligatory, but suggest a fix/reason for the bug, -->
   <!--- or ideas how to implement the addition or change -->
   
   ## 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. run docker with different port from 5984
   2. reverse proxy with changed port
   3. Get "Unauthorized" error
   
   ## Context
   <!--- How has this issue affected you? What are you trying to accomplish? -->
   <!--- Providing context helps us come up with a solution that is most useful in the real world -->
   
   ## Your Environment
   <!--- Include as many relevant details about the environment you experienced the bug in -->
   * Version used: Couchdb 3.3.3
   * Browser Name and version: Safari 16.5.2 
   * Operating System and version (desktop or mobile): Ubuntu 22.0.4
   * Link to your project:
   


-- 
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.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Change port not working for reverse proxy [couchdb-docker]

Posted by "sergey-safarov (via GitHub)" <gi...@apache.org>.
sergey-safarov commented on issue #254:
URL: https://github.com/apache/couchdb-docker/issues/254#issuecomment-3722516613

   Probable need to be fixed in CouchDB sources and not in docker image.
   Could you test reverse proxy + CouchDB without docker?
   
   This also may be related to port number included into `Host` header
   https://stackoverflow.com/questions/3364144/is-port-number-required-in-http-host-header-parameter
   
   You need also test case CouchDB listen 9564 inside container published like
   ```yaml
   couchdb:
       image: couchdb:3.3.3
       container_name: couchdb
       restart: unless-stopped
       ports:
         - "9564:9564"
   ```
   


-- 
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