Skip to content

fix(maintenance): allow AppAPI to serve requests during maintenance mode#61294

Merged
AndyScherzinger merged 1 commit into
masterfrom
fix/noid/appapi-maintenance-mode
Jun 23, 2026
Merged

fix(maintenance): allow AppAPI to serve requests during maintenance mode#61294
AndyScherzinger merged 1 commit into
masterfrom
fix/noid/appapi-maintenance-mode

Conversation

@oleksandr-nc

Copy link
Copy Markdown
Contributor

Summary

This PR allows AppAPI to work during the maintenance mode.

Reason? When admin enables maintenance mode, Nextcloud returns a 503 for every app route. This also shuts down AppAPI's own routes and its occ commands. But maintenance mode is when admins run backups and upgrades, so today this can break the whole ExApp setup.

Main findings from bug-reports:

  • HaRP can no longer read ExApp metadata from the NC or check user access from Nextcloud, so calls to running ExApps start failing with misleading 401/404 errors. If HaRP restarts during the maintenance window, every ExApp route stops working.
  • ExApps cannot report their status back to Nextcloud (those callbacks go over OCS), so any ExApp install or update that was in progress when maintenance started is left broken.
  • The occ app_api:* commands are not loaded during maintenance, so an admin cannot manage or recover ExApps from the command line either.

Conditions:

  1. AppAPI must be enabled to serve it's endpoints.
  2. No upgrade may be pending (needUpgrade() must be false) - as there can be a pending upgrade of AppAPI.

Everything else stays exactly as before (I hope 🤗)

We would also like to request a backport this for Nextcloud 34, for which we are already asking admins to use HaRP - and with it, this problem looks more serious.

Note: WebDAV and the other entry points are untouched. ExApp-provided dynamic occ commands (loaded from register_command.php) are intentionally not registered during maintenance.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@oleksandr-nc oleksandr-nc added this to the Nextcloud 34.0.1 milestone Jun 15, 2026
@oleksandr-nc oleksandr-nc requested a review from julien-nc June 15, 2026 12:53
@oleksandr-nc oleksandr-nc requested a review from a team as a code owner June 15, 2026 12:53
@oleksandr-nc oleksandr-nc requested review from ArtificialOwl, CarlSchwan, nfebe and sorbaugh and removed request for a team June 15, 2026 12:53
@oleksandr-nc oleksandr-nc added the 3. to review Waiting for reviews label Jun 15, 2026
Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
Comment thread lib/private/Console/Application.php

@marcelklehr marcelklehr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Changes look good. Did not test.

@AndyScherzinger AndyScherzinger merged commit 143e72d into master Jun 23, 2026
246 of 256 checks passed
@AndyScherzinger AndyScherzinger deleted the fix/noid/appapi-maintenance-mode branch June 23, 2026 08:10
@AndyScherzinger

Copy link
Copy Markdown
Member

/backport to stable34

@backportbot

backportbot Bot commented Jun 23, 2026

Copy link
Copy Markdown

The backport to stable34 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable34
git pull origin stable34

# Create the new backport branch
git checkout -b backport/61294/stable34

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick 1701f177

# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/61294/stable34

Error: Failed to check for changes with origin/stable34: No changes found in backport branch


Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@nextcloud nextcloud deleted a comment from backportbot Bot Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants