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

Rewrite Rule sample typo error #1069

Closed
JochenHWezel opened this issue Dec 24, 2018 · 10 comments
Closed

Rewrite Rule sample typo error #1069

JochenHWezel opened this issue Dec 24, 2018 · 10 comments

Comments

@JochenHWezel
Copy link

At https://docs.nextcloud.com/server/14/admin_manual/issues/general_troubleshooting.html#service-discovery there is a typo

RewriteRule ^\.well-known/host-meta /nextcloud/public.php?service=host-meta [QSA,L]
RewriteRule ^\.well-known/host-meta\.json /nextcloud/public.php?service=host-meta-json [QSA,L]
RewriteRule ^\.well-known/webfinger /nextcloud/public.php?service=webfinger [QSA,L]
RewriteRule ^\.well-known/carddav /nextcloud/remote.php/dav/ [R=301,L]
RewriteRule ^\.well-known/caldav /nextcloud/remote.php/dav/ [R=301,L]

needs to be

RewriteRule ^/\.well-known/host-meta /nextcloud/public.php?service=host-meta [QSA,L]
RewriteRule ^/\.well-known/host-meta\.json /nextcloud/public.php?service=host-meta-json [QSA,L]
RewriteRule ^/\.well-known/webfinger /nextcloud/public.php?service=webfinger [QSA,L]
RewriteRule ^/\.well-known/carddav /nextcloud/remote.php/dav/ [R=301,L]
RewriteRule ^/\.well-known/caldav /nextcloud/remote.php/dav/ [R=301,L]

Only with the / in the beginning, the rules are working.

@MorrisJobke
Copy link
Member

@JochenHWezel Could you directly change it in https://github.com/nextcloud/documentation/edit/master/admin_manual/issues/general_troubleshooting.rst. Then we can directly take the changes and don't need to redo them. Thanks :)

@MorrisJobke
Copy link
Member

The link to this is also at the top of every documentation page 😉

@JochenHWezel
Copy link
Author

@MorrisJobke sorry - I don't find the reuqired spare time for this handling with sources and forks etc. - could you please do it?

@MorrisJobke
Copy link
Member

MorrisJobke commented Jan 2, 2019

@MorrisJobke sorry - I don't find the reuqired spare time for this handling with sources and forks etc. - could you please do it?

My intention was to guide you, because it isn't really that hard anymore. You literally click that link I posted (or in the documentation at the top), then you do the change and you press "Save" together with a message why this change was made. No need to handle forks or check out files locally. 😉

@MorrisJobke
Copy link
Member

Fix is in #1100

@JochenHWezel
Copy link
Author

@MorrisJobke sorry - I don't find the reuqired spare time for this handling with sources and forks etc. - could you please do it?

My intention was to guide you, because it isn't really that hard anymore. You literally click that link I posted (or in the documentation at the top), then you do the change and you press "Save" together with a message why this change was made. No need to handle forks or check out files locally. 😉

@MorrisJobke It would be nice if it could be that easy! Currently and with the given link, I just see
image
Maybe the authorizations for you are differently and it's possible to you. This might be misleading that everybody could do it the same way?

backportbot-nextcloud bot pushed a commit that referenced this issue Jan 4, 2019
@MorrisJobke
Copy link
Member

Maybe the authorizations for you are differently and it's possible to you. This might be misleading that everybody could do it the same way?

Ah - okay. But then this is the only additional click you need to do. Github does the forking for you and after the change is merged you can delete the forked repository again. Anyways - thanks for the hint and the update.

@blipp
Copy link

blipp commented Feb 16, 2019

Hi, I am using Nextcloud 15.0.4, and I actually need to not have these slashes to get the rewrite rules to work. I am using Apache on Uberspace version 7.

@blipp
Copy link

blipp commented Feb 16, 2019

@JochenHWezel Did you upgrade to Nextcloud 15 in the meantime? Do you have anything else in your .htaccess?

@JochenHWezel
Copy link
Author

@blipp In fact, Nextcloud 15 already runs productive on my server for several weeks. This is my current site confguration file, but there is no additional change regarding rewrite rules except that I prefer 302 redirects instead of 301 redirects.

<IfModule mod_ssl.c>
<VirtualHost *:443>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin admin@myserver.de
        DocumentRoot /var/www/cloud_webroot

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
        SSLCertificateFile /etc/letsencrypt/live/cloud.myserver.de/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/cloud.myserver.de/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
        ServerName cloud.myserver.de

        <IfModule mod_headers.c>
              Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
              Header always set Referrer-Policy "same-origin"

        </IfModule>

        RewriteEngine on
        RewriteRule ^/\.well-known/host-meta /cloud/public.php?service=host-meta [QSA,L]
        RewriteRule ^/\.well-known/host-meta\.json /cloud/public.php?service=host-meta-json [QSA,L]
        RewriteRule ^/\.well-known/webfinger /cloud/public.php?service=webfinger [QSA,L]
        RewriteRule ^/\.well-known/carddav /cloud/remote.php/dav/ [R=302,L]
        RewriteRule ^/\.well-known/caldav /cloud/remote.php/dav/ [R=302,L]


</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
</IfModule>

skjnldsv added a commit that referenced this issue Jun 14, 2019
Correct error in .htaccess, revert #1069
backportbot-nextcloud bot pushed a commit that referenced this issue Jun 16, 2019
The forward slashes are only needed if the rewrite rules are being put directly into the config file of the apache virtual host. They should not be added to the .htaccess file, as in this case the redirect is not working (this has been tested by me on multiple systems).

You can also see in the discussion of the bug report #1069 after it was merged, that the reporter actually put the rules into his apache conf, instead of a .htaccess and that somebody else was reporting, that it was only working without the forward slashes in a .htaccess file.
backportbot-nextcloud bot pushed a commit that referenced this issue Jun 16, 2019
The forward slashes are only needed if the rewrite rules are being put directly into the config file of the apache virtual host. They should not be added to the .htaccess file, as in this case the redirect is not working (this has been tested by me on multiple systems).

You can also see in the discussion of the bug report #1069 after it was merged, that the reporter actually put the rules into his apache conf, instead of a .htaccess and that somebody else was reporting, that it was only working without the forward slashes in a .htaccess file.
skjnldsv added a commit that referenced this issue Jun 16, 2019
[stable16] Correct error in .htaccess, revert #1069
skjnldsv added a commit that referenced this issue Jun 16, 2019
[stable15] Correct error in .htaccess, revert #1069
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