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

Pretty urls don't work if it's only a domain with no trailing slash #10678

Closed
mjanssens opened this issue Aug 13, 2018 · 14 comments
Closed

Pretty urls don't work if it's only a domain with no trailing slash #10678

mjanssens opened this issue Aug 13, 2018 · 14 comments

Comments

@mjanssens
Copy link

@mjanssens mjanssens commented Aug 13, 2018

Steps to reproduce

  1. manual upgrade from NC 13.0.5 to 14.0.0 Beta 3
  2. login on upgraded nextcloud website

Expected behaviour

URL should be:
https://fqdnservername/apps/activity/

Actual behaviour

https://fqdnservername/index.php/apps/activity/

Server configuration

Operating system:
Debian 9.5

Web server:
Apache/2.4.25

Database:
PostgreSQL 9.6.10

PHP version:
7.0.30

Nextcloud version: (see Nextcloud admin page)
14.0.0 Beta 3

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

Where did you install Nextcloud from:
Manual install, sources from nc website

List of activated apps:

App list Enabled: - accessibility: 1.0.1 - activity: 2.7.0 - cloud_federation_api: 0.0.1 - comments: 1.4.0 - dav: 1.6.0 - federatedfilesharing: 1.4.0 - federation: 1.4.0 - files: 1.9.0 - files_pdfviewer: 1.3.2 - files_sharing: 1.6.2 - files_texteditor: 2.6.0 - files_trashbin: 1.4.1 - files_versions: 1.7.1 - files_videoplayer: 1.3.0 - firstrunwizard: 2.3.0 - gallery: 18.1.0 - logreader: 2.0.0 - lookup_server_connector: 1.2.0 - nextcloud_announcements: 1.3.0 - notifications: 2.2.1 - oauth2: 1.2.1 - password_policy: 1.4.0 - provisioning_api: 1.4.0 - serverinfo: 1.4.0 - sharebymail: 1.4.0 - support: 1.0.0 - survey_client: 1.2.0 - systemtags: 1.4.0 - theming: 1.5.0 - twofactor_backupcodes: 1.3.0 - updatenotification: 1.4.1 - workflowengine: 1.4.0 Disabled: - admin_audit - encryption - files_external - user_external - user_ldap

Nextcloud configuration:

Config report

{
"system": {
"instanceid": "REMOVED SENSITIVE VALUE",
"passwordsalt": "REMOVED SENSITIVE VALUE",
"secret": "REMOVED SENSITIVE VALUE",
"trusted_domains": [
"nctest13pgsql.lan"
],
"datadirectory": "REMOVED SENSITIVE VALUE",
"overwrite.cli.url": "https://nctest13pgsql.lan",
"htaccess.RewriteBase": "/",
"dbtype": "pgsql",
"memcache.local": "\OC\Memcache\APCu",
"version": "14.0.0.15",
"dbname": "REMOVED SENSITIVE VALUE",
"dbhost": "REMOVED SENSITIVE VALUE",
"dbport": "",
"dbtableprefix": "oc_",
"dbuser": "REMOVED SENSITIVE VALUE",
"dbpassword": "REMOVED SENSITIVE VALUE",
"installed": true,
"maintenance": false,
"loglevel": 2,
"mail_smtpmode": "sendmail",
"mail_smtpauthtype": "LOGIN"
}
}

Are you using external storage, if yes which one: local/smb/sftp/...
No

Are you using encryption: yes/no
No

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
No

Client configuration

Browser:
Firefox 61.0.1

Operating system:
OpenSUSE Tumbleweed

Extra remarks:
Also tried to update htaccess via command:
sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess
but reponse is:
Error updating .htaccess file, not enough permissions or "overwrite.cli.url" set to an invalid URL?

www-data owns htaccess files and is writable.

This is a test intance for my nextcloud.
I already upgraded via same procedure from 13.0.0 to 13.0.5 without issues

@nextcloud-bot nextcloud-bot added the bug label Aug 13, 2018
@nextcloud-bot

This comment has been minimized.

Copy link
Member

@nextcloud-bot nextcloud-bot commented Aug 13, 2018

GitMate.io thinks possibly related issues are #359 (Theming app doesn't work when pretty URLs is enabled), #7547 ([Clarification Request or Bug] Pretty Urls does not work for me), #5975 (Preview of theming does not work anymore), #10112 (Access over old URL ../owncloud no longer works), and #9182 (Just a question // Feature request // Pretty Share URL).

@mjanssens

This comment has been minimized.

Copy link
Author

@mjanssens mjanssens commented Aug 14, 2018

Some further testing:
Same result when using the webupdater and selecting option "Yes", continuing with “Command line based upgrade".
sudo -u www-data php /var/www/nextcloud/occ upgrade gives no errors.
But result is no pretty urls.
sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess give same error as reported.

Choosing option "No" and using webbased upgrade gives result as expected, pretty urls are working.

@tflidd tflidd added the 14-feedback label Aug 15, 2018
@kesselb

This comment has been minimized.

Copy link
Contributor

@kesselb kesselb commented Aug 15, 2018

When you run maintenance:update:htaccess from cli this code is executed https://github.com/nextcloud/server/blob/master/lib/private/Setup.php#L446

image

Could you change overwrite.cli.url to 'https://nctest13pgsql.lan/' (append a /) and try again?

@mjanssens

This comment has been minimized.

Copy link
Author

@mjanssens mjanssens commented Aug 15, 2018

Tested with 'overwrite.cli.url' => 'https://nctest13pgsql.lan/'
And that fixed it. Pretty urls are working again, maintenance command gives no error and updates htaccess file.

@mjanssens mjanssens changed the title Pretty urls do not work anymore Pretty urls don't work after occ upgrade Aug 16, 2018
@mjanssens

This comment has been minimized.

Copy link
Author

@mjanssens mjanssens commented Sep 3, 2018

Issue is closed, however I have to note that a default install won't put a trailing forward slash.
Also in documentation for pretty urls, no trailing forward flash is mentioned.

@seblu

This comment has been minimized.

Copy link

@seblu seblu commented Sep 7, 2018

I add this issue too after upgrading from 13.0.6 to 14.0.0.9.

If the missing / could not be handled in code, a warning somewhere in docs would save time.

@kesselb

This comment has been minimized.

Copy link
Contributor

@kesselb kesselb commented Sep 9, 2018

@MorrisJobke what problem did you try to fix with 82869b6? I could move the logic to a static method findWebroot and introduce a unit test for it to make this more stable.

@minils

This comment has been minimized.

Copy link

@minils minils commented Sep 13, 2018

This should be mentioned in the documentation

@MorrisJobke

This comment has been minimized.

Copy link
Member

@MorrisJobke MorrisJobke commented Sep 24, 2018

@MorrisJobke what problem did you try to fix with 82869b6?

Just a misconfiguration.

If the missing / could not be handled in code, a warning somewhere in docs would save time.

It would be better to detect this and add it automatically. Basically this applies only to the domain without a path.

@MorrisJobke MorrisJobke reopened this Sep 24, 2018
@MorrisJobke MorrisJobke changed the title Pretty urls don't work after occ upgrade Pretty urls don't work if it's only a domain with no trailing slash Sep 24, 2018
@kesselb

This comment has been minimized.

Copy link
Contributor

@kesselb kesselb commented Sep 28, 2018

@MorrisJobke would #11446 work for the case you fixed with 82869b6?

@b3

This comment has been minimized.

Copy link

@b3 b3 commented Oct 8, 2018

On my 14.0.1.1 installed version adding the trailing / do not fix the problem at all.
Pretty URL do not work anymore at this stage.

@kesselb

This comment has been minimized.

Copy link
Contributor

@kesselb kesselb commented Oct 8, 2018

Please take a look at #11673. Maybe this works for you as well.

@b3

This comment has been minimized.

Copy link

@b3 b3 commented Oct 8, 2018

Unfortunately not: mod_env is available on my setup, htaccess.RewriteBase is setup to / and still occ maintenance:update:htaccess does not add the specified section in the .htaccess but produce the Error updating .htaccess file, not enough permissions or "overwrite.cli.url" set to an invalid URL? message.

The strange thing is that the disappearance of the pretty URL have clearly been introduced by the upgrade process from 13.0.6 to 14.0.1.1 which have been done through the web interface and finished by the CLI command occ upgrade.

@b3

This comment has been minimized.

Copy link

@b3 b3 commented Oct 9, 2018

I find the trouble: I was guilty, and adding the trailing slash fixed the pretty URL.
I still use an old script from my initial installation to fix rights after every upgrade (https://docs.nextcloud.com/server/9/admin_manual/installation/installation_wizard.html#strong-perms-label) which gives the .htaccess to root and not to the web server user. This part of the manual disappeared in 10, but since I only have done upgrade I did not notice that this was not up to date informations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants
You can’t perform that action at this time.