NextCloud 11 with IIS Reverse Proxy - Some Images links not correct

I’m having a quite odd issue, which i have a work around for but i suspect its a bug.

I’ve downloaded the Latest NextCloud Appliance and its running 11.0.2.

I then have a Reverse Proxy setup using an IIS server and everything works as expected, with the exception of a couple of Images.
I followed the instructions from here (https://docs.nextcloud.com/server/11/admin_manual/configuration_server/reverse_proxy_configuration.html) and there were no odd surprises or anything to me.

The images that are not correct are:

  • Top right menu bar
  • Under the Personal area, the Get Apps images
  • Under the Admin section, The ones under the License AGPL note.

They are redirecting to https ://nextcloud.domain.com/settings/img/help.svg?v=0… or https ://nextcloud.domain.com/core/img/googleplay.png

The correct redirection should be https ://nextcloud.domain.com/nextcloud/settings/img/help.svg?v=0… or https: //nextcloud.domain.com/nextcloud/core/img/googleplay.png

I can simply create a rule that rewrites/redirects those to the correct locations, but i’m wondering if there might be a bug for these few images? All other images/pages are being redirected correctly.
I’ve tried adding a trailing slash to the overwrite webroot and client url without success.

Config.php

'trusted_proxies' => array ( 0 => 'localhost', 1 => '192.168.x.y', 2 => 'rproxysvr', 3 => 'rproxysvr.int.domain.com', ), 'overwritehost' => 'nextcloud.domain.com', 'overwriteprotocol' => 'https', 'overwritewebroot' => '/nextcloud', 'overwritecondaddr' => '^192\.168\.x\.y$', 'overwrite.cli.url' => 'https://nextcloud.domain.com/nextcloud/',

for my IIS server, here’s my web.config file
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="ReverseProxyInboundRule1" stopProcessing="true"> <match url="(.*)" /> <action type="Rewrite" url="http://192.168.x.y/{R:1}" /> </rule> </rules> </rewrite> </system.webServer> </configuration>

Bump
Anyone else seen this issue?

I haven’t seen this issue but everything’s working fine on my IIS with the following web.config (obviously put in your own domain and local IP). You have to click “View Server Variables” then add the HTTP_ACCEPT_ENCODING variable first.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="http://LOCAL IP/{R:1}" />
                    <serverVariables>
                        <set name="HTTP_ACCEPT_ENCODING" value="True" />
                    </serverVariables>
                </rule>
            </rules>
            <outboundRules>
                <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
                    <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^http(s)?://LOCAL IP/(.*)" />
                    <action type="Rewrite" value="http{R:1}://NEXTCLOUD DOMAIN.com/{R:2}" />
                </rule>
                <preConditions>
                    <preCondition name="ResponseIsHtml1">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                    </preCondition>
                </preConditions>
            </outboundRules>
        </rewrite>
    </system.webServer>
</configuration>

Hi guys,

I’ve found your thread and it’s similar to my situation, so I hope you can help me with this!
I have a IIS7.5 in front of the nextcloud standard appliance VM community 11.0.2.

I search for month now how can I set my web.config and the nextcloud config.php to work together.

I have installed ARR and URL rewrite on the IIS (with reverse proxy enabled) but all of my tests failed.

My configuration:
internet domain= https: my.homeserver.com => IIS7.5 (local server 192.168.x.y) others websites are hosted by this server.
Appliance nextcloud 192.168.x.z servername= nextcloud

What I want is:
When I go to https: my.homeserver.com/nextcloud/ the IIS proxify to apache nextcloud
and all url will be rewrite with https: my.homeserver.com/nextcloud/blablabla.php.

I have searched and found this guide https: docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing that help me to begin but when I browse the nextcloud site the reply are on http: 192.168.x.z/login.php and taht’s all the problem.

Could you please send me the right web.config and config.php to do this?

Thanks in advance for your help.

regards
arjz

arjz,

I know this is a bit late, but I was having some of the same issues. My config.php file is the following:

<?php
$CONFIG = array (
'passwordsalt' => '[redacted]',
'secret' => '[redacted]',
'trusted_domains' =>
array (
0 => 'localhost',
1 => 'nextcloud',
2 => '192.168.[local].[address]',
3 => 'cloud.[our].[domain]',
),
'datadirectory' => '/var/ncdata',
'overwrite.cli.url' => 'https://cloud.[our].[domain]/nextcloud',
'overwriteprotocol' => 'https',
'overwritehost' => 'cloud.[our].[domain]',
'overwritecondaddr' => '192\.168\.[proxy]\.[ip]$',
'trusted_proxies' =>
array (
0 => '192.168.[proxy].[ip]',
),
'forwarded_for_headers' =>
array (
0 => 'HTTP_X_FORWARDED',
1 => 'HTTP_X_FORWARDED_FOR',
),
'dbtype' => 'mysql',
'version' => '12.0.3.3',
'dbname' => '[redacted]',
'dbhost' => 'localhost',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => '[redacted]',
'dbpassword' => '[redacted]',
'installed' => true,
'instanceid' => '[redacted]',
'maintenance' => false,
'mail_smtpmode' => 'smtp',
'log_rotate_size' => '10485760',
'memcache.local' => '\\OC\\Memcache\\Redis',
'filelocking.enabled' => true,
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => '/var/run/redis/redis.sock',
'port' => 0,
'timeout' => 0,
'dbindex' => 0,
'password' => '[redacted]',
),
'htaccess.RewriteBase' => '/',
'loglevel' => '2',
'log_type' => 'file',
'logfile' => '/var/ncdata/nextcloud.log',
'logtimezone' => 'America/Chicago',
'ldapIgnoreNamingRules' => false,
'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory',
);

And the web.config file is the following:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<outboundRules>
<rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1" enabled="true">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^http(s)?://192.168.[local].[address]/(.*)" />
<action type="Rewrite" value="http{R:1}://cloud.[our].[domain]/{R:2}" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
    <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
<rules>
<rule name="ReverseProxyInboundRule1" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
    <add input="{CACHE_URL}" pattern="^(https?)://" />
</conditions>
<action type="Rewrite" url="{C:1}://192.168.[local].[address]/{R:1}" />
<serverVariables>
    <set name="HTTP_ACCEPT_ENCODING" value="True" />
</serverVariables>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

I’ve got two issues with it: I can’t use the Nextcloud desktop application and there is a redirect issue going from http to https. Otherwise, it is working OK.