Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The reverse proxy header configuration is incorrect, or you are accessing Nextcloud from a trusted proxy #101

Closed
sinichi19 opened this issue May 25, 2021 · 11 comments

Comments

@sinichi19
Copy link

image

Ubuntu 20.04
Apache2
PHP 7.4
Nextcloud 21.0.2

After I successfully installed the Nc21 my overview are all passed and no warning but after I installed the Notify Push (HPB) and working using the official documentation I got a warning on my overview

Looking for your kind assistance what I missed or need to add to complete my configurations.

May I know if this is critical? If yes will not use for now the Nofity push (HPB)

Thank You and More Power

@alerque
Copy link

alerque commented May 25, 2021

What does the trusted_proxies key look like in your Nextcloud config file?

@sinichi19
Copy link
Author

What does the trusted_proxies key look like in your Nextcloud config file?

Thank you Sir @alerque for your reply.
heres the truested proxies on my config.php created by notify_push

'trusted_proxies' =>
array (
0 => '127.0.0.1',
1 => '::1',
2 => 'xx.xx.xx.xx', #my ip recommended by notify_push to add
),

@alerque
Copy link

alerque commented May 25, 2021

That actually looks right, how about your apache virtual host config?

@sinichi19
Copy link
Author

@alerque

only using offcial. documentation
(ssl certificate not included below but thats my apache)

<VirtualHost *:443>
DocumentRoot /var/www/nextcloud/
ServerName your.server.com

<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews

<IfModule mod_dav.c>
  Dav off
</IfModule>

ProxyPass /push/ws ws://127.0.0.1:7867/ws
ProxyPass /push/ http://127.0.0.1:7867/
ProxyPassReverse /push/ http://127.0.0.1:7867/

@alerque
Copy link

alerque commented May 25, 2021

You have trailing slashes on your proxy locations. Try them this way:

ProxyPass /push/ws ws://127.0.0.1:7867/ws
ProxyPass /push http://127.0.0.1:7867
ProxyPassReverse /push http://127.0.0.1:7867

@sinichi19
Copy link
Author

You have trailing slashes on your proxy locations. Try them this way:

ProxyPass /push/ws ws://127.0.0.1:7867/ws
ProxyPass /push http://127.0.0.1:7867
ProxyPassReverse /push http://127.0.0.1:7867

will try this tomrrow sir, im only using the official documentation.

hopping the warning message will remove😀

will update you sir

thank you very much

@alerque
Copy link

alerque commented May 25, 2021

You keep saying "the official documentation" as if it was some inspired text. I doubt the author even uses Apache, I bet they use NGIX themselves and just copied the Apache syntax from some random place on the internet. Even if that's not the case they could still have made a mistake.

@alerque
Copy link

alerque commented May 25, 2021

For reference, I suggest a completely different layout to your virtual host. Using <Directory> for that is kind of strange, and there are other oddities in your setup. My setup uses php-fpm, which may not be relevant, but other relevant lines from my working production server looks like this:

<VirtualHost *:443>
⇥   ServerName nextcloud.example.com
⇥   DocumentRoot /usr/share/webapps/nextcloud

⇥   Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"ProxyPass /push/ws ws://127.0.0.1:7867/ws

⇥   <Location /push>
⇥   ⇥   ProxyPass http://127.0.0.1:7867
⇥   ⇥   ProxyPassReverse http://127.0.0.1:7867
⇥   </Location>

⇥   <Location />
⇥   ⇥   Options FollowSymlinks Includes
⇥   ⇥   Require all granted
⇥   ⇥   AllowOverride all
⇥   ⇥   php_admin_value open_basedir "/tmp/:/usr/share/webapps/nextcloud/:/etc/webapps/nextcloud:/var/lib/nextcloud/apps:/dev/urandom"
⇥   ⇥   Dav off
⇥   </Location>

⇥   DirectoryIndex index.php index.html
⇥   <FilesMatch \.php$>
⇥   ⇥   SetHandler "proxy:unix:/run/nextcloud/nextcloud.sock|fcgi://localhost/"
⇥   </FilesMatch>

⇥   ErrorLog /var/log/httpd/nextcloud.example.com.info-error_log
⇥   CustomLog /var/log/httpd/nextcloud.example.com.info-access_log common
</VirtualHost>

Yes that is my complete vhost with only the domain name changed. My SSL cert handling is elsewhere in Apache, and SSLEngine, SSLProxyEngine & RewriteEngine are turned of by default for all vhosts.

@sinichi19
Copy link
Author

Sir @alerque thank you so much for this, will try this also, im only new using linux thats why im often to follow the documentation.

Greatly appreciated your kind assistance

im using sectigo certificate its ok to your apache config to add the certificate path the normal code for ssl in apache.

thank you and God bless

@sinichi19
Copy link
Author

sinichi19 commented May 26, 2021

@alerque Sir I tried your config
⇥ ProxyPass /push/ws ws://127.0.0.1:7867/ws

⇥ <Location /push>
⇥ ⇥ ProxyPass http://127.0.0.1:7867
⇥ ⇥ ProxyPassReverse http://127.0.0.1:7867

Think this is related to this post https://github.com/nextcloud/server/issues/26796

Notify push is working but the proxy warning on my nextcloud overview still there.

Thank You

@szaimen
Copy link
Contributor

szaimen commented Aug 11, 2021

Fixed with nextcloud/server#25605

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants