Skip to content

Grant Access page using HTTP when behind proxy #18283

@austenadler

Description

@austenadler

Steps to reproduce

  1. Put Nginx behind a reverse proxy (https external; http internal)
  2. Create a new account, open the authorization url (looks like: http://nextcloud.example.com/index.php/login/v2/flow/random-string/random-string)
  3. Click log in, enter username/password, click login
  4. Try to click "Grant Access"

Expected behaviour

Grant Access should work and be routed to https://nextcloud.example.com/index.php/login/v2/grant

Actual behaviour

Grant Access does not work since http://nextcloud.example.com/index.php/login/v2/grant is the action of the form. An error is showed in the console about unsafe URLs
Screenshot; private info replaced with zzz
image

Server configuration

Operating system: Docker host is Devuan, but using nextcloud official Docker image

Web server: Reverse proxy runs on Nginx

Database: Mariadb

PHP version:

Nextcloud version: 17.0.1

Updated from an older Nextcloud/ownCloud or fresh install: Updated

Where did you install Nextcloud from: Docker

Signing status:

Signing status
No errors have been found.

List of activated apps:

App list
If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your Nextcloud installation folder

Reverse Proxy Configuration (nginx):

Proxy config
location / {
	# NOTE: http://
	proxy_pass http://nextcloud:80/;
	proxy_set_header Host $host;
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header X-Forwarded-Proto $scheme;
	add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
	client_max_body_size 0;
}

Nextcloud configuration:

Config report
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "nextcloud.example.com"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/nextcloud.example.com",
        "dbtype": "mysql",
        "version": "17.0.1.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtpauthtype": "LOGIN",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "theme": "",
        "loglevel": 2,
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}

Nextcloud log (data/nextcloud.log)

Nextcloud log
-

Browser log

Browser log
JQMIGRATE: Migrate is installed, version 1.4.1 jquery-migrate.min.js:2:551
Content Security Policy: The page’s settings blocked the loading of a resource at http://nextcloud.example.com/index.php/login/v2/grant (“form-action”).

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmapbugneeds info

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions