Return 503 status code when in upgrade mode
See original GitHub issueWhen a new Umbraco version is deployed (to a live website) and the database needs to be upgraded, all requests are redirected to:
302 Found
, redirect to:/install/?redir=true&url=
302 Found
, redirect to:/umbraco/AuthorizeUpgrade?redir=
200 OK
, login screen to authorize/accept the upgrade
This is bad in multiple ways:
- Search engines might index this page, removing the actual content from the index and causing duplicate content (as this page is returned for all requests, albeit via a temporary redirect);
- The first responses are redirects, which might confuse search engines or at least might have a negative impact;
- Status monitoring software (doing HTTP checks) will think everything is OK (which it clearly isn’t).
Reproduction
Bug summary
The upgrade screen returns a 200 OK
response, instead of a 503 Service Temporarily Unavailable
.
Specifics
Umbraco 7: https://github.com/umbraco/Umbraco-CMS/blob/54a2aa00a78caa4e6fe7b3b3cb9ff418fd1f408d/src/Umbraco.Web/Install/Controllers/InstallController.cs#L37-L62 https://github.com/umbraco/Umbraco-CMS/blob/54a2aa00a78caa4e6fe7b3b3cb9ff418fd1f408d/src/Umbraco.Web/Editors/BackOfficeController.cs#L145-L158
Umbraco 8: https://github.com/umbraco/Umbraco-CMS/blob/cea8753ff28a3b6c695ffd10e183c9f4e6fb5e45/src/Umbraco.Web/Install/Controllers/InstallController.cs#L37-L60 https://github.com/umbraco/Umbraco-CMS/blob/12dff9bca31aa1486aa418a0d8b66d42154896c9/src/Umbraco.Web/Editors/BackOfficeController.cs#L142-L155
Steps to reproduce
Make sure the installation is in a upgrade state (e.g. assemblies/Umbraco configuration status does not match migrations in database).
Expected result
Return a 503 Service Temporarily Unavailable
status code, as is advised by Google: https://webmasters.googleblog.com/2011/01/how-to-deal-with-planned-site-downtime.html.
Actual result
Return a 200 OK
status code.
It would be even better if the authorization/acceptence of the upgrade could be done some other way, so this page isn’t shown at all. This was already discussed on https://issues.umbraco.org/issue/U4-11520 and https://github.com/umbraco/Umbraco-CMS/pull/2789. Upgrading the site locally and then just deploying a working copy to production should then just automatically upgrade the database (as all other changes are already applied, e.g. updating the Umbraco configuration status, ClientDependency version, etc.).
Issue Analytics
- State:
- Created 4 years ago
- Comments:18 (12 by maintainers)
So hey. This issue seems very related to mine as well (if not exact)
This Authorize Upgrade page shows up out of the blue at 2am, cuts off ALL TRAFFIC for major clients who rely on their site being live for income for upwards of 10+ hours and to top it all off we don’t even want the update. Mayhaps this discussion is in regards to manual upgrades but i’ve only ever had it happen out of the blue for seemingly no reason and it’s a HUGE problem for me.
This isn’t true in the slightest. The upgrade isn’t being performed yet, that’s why we’re getting redirected to a log-in page to authorise it. Developers, site owners, aren’t going to be there to approve the upgrade the exact moment it’s requested either. So it’s not a matter of a “minute”. It might be hours. Worst case scenario, it’s days. Yes, it is a “problem”. You cannot in good conscience tell me that it’ll be authorised instantly and the whole process from the moment of redirect to live is finished within the minute. As far as i’m aware, we’re not even notified of it needing authorised in the first place.
Hence why this is also a problem as originally stated. The entire site is down (not technically, but from their standpoint it may as well be) make no mistake, and Umbraco is the reason why. Our clients stop making money, it’s literally worst case scenario, all hands on deck for them and for us when we finally get the Ticket in.
This is a pretty huge red flag for me. I’m surprised there’s not more alarm at ALL TRAFFIC being redirected to your sites admin login page on a LIVE website until an admin notices and then authorises an upgrade. (Assuming it’s actually wanted in the first place)
If that isn’t a “problem” to you I’m concerned. That’s not how updates should be getting delivered. Ever.
We don’t want to upgrade because we don’t know what’ll break in custom sites. It’s not essential as relaunching the site will prevent the redirects for that update from happening again. So what is it that’s forcing the redirects to all traffic to upgrade in the first place?
We have a lot of Umbraco Clients, it’d be nice to know for the future how to prevent this happening. Can we prevent the redirects?
This would perhaps be the 3rd or 4th time in the last 2 months.
Alright guys, thanks for the heads up.
I think I misread the intentions of the original author. I thought they were complaining about the upgrade mode redirecting all traffic. That was my initial grievance. Their highlighted problems hit the nail on the head why that’s an issue for me right now as well. So I was confused when the solution was to just redirect them somewhere else and that was accepted, haha.
But from my understanding of what you guys are saying, Umbraco has to do that since it’s in a half-complete state where it would otherwise be incapable of rendering the site. Ideally, I wouldn’t want the 503 error either, it’d still be downtime on a live site which clients will fume at the mouth over. So my issue then i’ll need to look into is why it’s triggering Upgrade Mode in the first place and prevent it unless we’re actually manually upgrading the site, for realsies.
I don’t see how this would be resolved by restarting my site either, but there’s lot of weird interactions between FileZilla and Umbraco from my experience, so this actually struck me as being very plausible. It’ll be something to investigate. You’ve definitely given me a few ideas to look into now. Once I get some logs together, i’ll share them on the forums if I need additional help deciphering.
Many thanks,
On Tue, 28 Jan 2020 at 19:49, Claus notifications@github.com wrote: