4946: Review Board site configured with non-standard port causes draft API call to fail

aparker591

What version are you running?

4.0.4

What's the URL of the page containing the problem?

http://reviews.example.com:2001/r/1/

What steps will reproduce the problem?

  1. Brand new, clean RB site spun up with slightly modified Docker Compose example configuration published in the Review Board documentation. Server OS is RHEL 8 with latest Docker. The key modification I made to the config was that we're running nginx with a nonstandard port (2001). See attached for redacted Docker configs. This example uses plain HTTP, but it doesn't affect the result.
  2. Run the docker compose and watch as the clean site is set up from scratch.
  3. Log into the site with the default admin credentials.
  4. Go to Admin > General and add :2001 to the end of what's in the Server textbox. So in this example, it would be http://reviews.example.com:2001 now. Save the change.
  5. Click New Review Request and enter anything in Description, then click OK.

What is the expected output? What do you see instead?

The expected output is that the change is accepted and the Loading spinner at the top goes away quickly.

Instead, the spinner gets stuck does not accept the change.

When looking at the browser's dev tools, this is the draft API call that is issued. Note that it is missing the :2001 port and therefore fails.
http://reviews.example.com/api/review-requests/1/draft/?api_format=json&force-text-type=html&include-text-types=raw&expand=depends_on,target_people,target_groups

There are other API calls logged in the dev tools as the page originally loaded, and those properly use the port, leading me to believe this is a bug somewhere.

What operating system are you using? What browser?

Server: RHEL 8 Docker
Client: Windows 10 with Firefox, Chrome, and Edge all affected

Please provide any additional information below.

Bonus issue: Not sure if this is related, but after saving the change to the Server textbox in the Admin > General configuration page (step 4), if you repeatedly click the General link, it'll reload the page sometimes with the correct "Server" value and sometimes with the previous value that was there before the change was saved. Flushing memcached doesn't seem to stop this from happening.

upstream reviewboard {
    server reviewboard:8080;
}
server {
    server_name ${NGINX_HOST};
    listen ${NGINX_PORT};
    root /var/www/reviewboard/htdocs;
    location / {
        proxy_pass http://reviewboard;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
    }
    location /media/ {
        alias /var/www/reviewboard/htdocs/media/;
        add_header Access-Control-Allow-Origin *;
        expires max;
        location ~ \.(html|htm|shtml|php)$ {
            types {}
            default_type text/plain;
        }
    }
    location /static/ {
        alias /var/www/reviewboard/htdocs/static/;
        add_header Access-Control-Allow-Origin *;
        expires max;
    }
    location /errordocs/ {
        alias /var/www/reviewboard/htdocs/errordocs/;
        expires 30d;
    }
}
version: '3.7'
services:
  db:
    image: mysql:8
    environment:
      - MYSQL_ROOT_PASSWORD=Password1
      - MYSQL_DATABASE=reviewboard
      - MYSQL_USER=reviewboard
      - MYSQL_PASSWORD=reviewboard123
    volumes:
      - db_data:/var/lib/mysql
    restart: 'on-failure'
  memcached:
    image: memcached:alpine
    restart: 'on-failure'
  reviewboard:
    image: beanbag/reviewboard:4.0.4
    depends_on:
      - db
      - memcached
    environment:
      - COMPANY=ExampleCompany
      - DATABASE_TYPE=mysql
      - DATABASE_USERNAME=root
      - DATABASE_PASSWORD=Password1
      - DOMAIN=reviews.example.com
      - REVIEWBOARD_GROUP_ID=10001
      - REVIEWBOARD_USER_ID=10000
    ports:
      - 8080:8080
    volumes:
      - sitedir:/site
  nginx:
    image: nginx:alpine
    restart: always
    depends_on:
      - reviewboard
    environment:
      - NGINX_HOST=reviews.example.com
      - NGINX_PORT=2001
    ports:
      - 2001:2001
    volumes:
      - sitedir:/var/www/revie
david
#1 david

Setting the server name in the admin is the right thing. I'd suggest restarting the webserver to clear out any lingering threads that were started with the old setting, and doing a shift+reload on the browser side to clear any caches there.

  • -New
    +SetupIssue
#2 aparker591

Thanks for your response! I restarted all the docker containers many times while troubleshooting this, and it still calls http://reviews.example.com/api/review-requests/5/draft/ without the port, but DOES correctly call this one with the port on the same page as it initially loads: http://reviews.example.com:2001/api/review-requests/5/