question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Return 503 status code when in upgrade mode

See original GitHub issue

When 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:closed
  • Created 4 years ago
  • Comments:18 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
DaveYognaughtcommented, Jan 28, 2020

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.

Just as a note that this is a very theoretical “problem” you’re pointing out here and quite the edge case that a crawler would index your site in the exact minute that an upgrade is being performed.

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.

Status monitoring software (doing HTTP checks) will think everything is OK (which it clearly isn’t).

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.

When a new Umbraco version is (sic: automatically) deployed (to a live website) and the database needs to be upgraded, all requests are redirected.

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.

1reaction
DaveYognaughtcommented, Jan 28, 2020

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.

wrong/old version numbers in the configuration files

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:

@RyanWilson-byte https://github.com/RyanWilson-byte If what you say is true, I think there’s something happening in your setup/process for upgrades that you are not completely aware of. No one is pushing any automatic upgrades to your site - there is no such functionality to do so in Umbraco.

If your site is indeed being upgraded, it is because something in your infrastructure setup (build pipeline?) has pushed an upgraded version of Umbraco to your live site. It is not something that Umbraco can do by itself. There’s not even an upgrade button or anything that can do this - it is a very manual process.

As @ronaldbarendse https://github.com/ronaldbarendse mentions however, I think you could trigger the upgrade screen to show even though an upgrade is actually not available, if you by accident put wrong/old version numbers in the configuration files. So maybe this is what is causing it to show up. On the other hand - I don’t really see how this would be resolved by just restarting your site, so it might be something else 🤷‍♂

I however concur with @ronaldbarendse https://github.com/ronaldbarendse that this is not related to this issue and would also encourage you to post on the forums for further assistance on your issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/umbraco/Umbraco-CMS/issues/6334?email_source=notifications&email_token=AN7E3SWMOXDCFK6URDBSQ4TRACD43A5CNFSM4IWDMKRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKEU4IY#issuecomment-579423779, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN7E3STQU7DM4IAK5RP6E3TRACD43ANCNFSM4IWDMKRA .

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix the HTTP Error 503 Service Unavailable (6 Steps)
The HTTP Error 503 status code indicates that the server is currently unable to handle the request. Find out more about the causes...
Read more >
503 Service Unavailable Error: What It Is and How to Fix It
A 503 Service Unavailable Error is an HTTP response status code indicating that a server is temporarily unable to handle the request.
Read more >
503 Service Unavailable - HTTP - MDN Web Docs
The HyperText Transfer Protocol (HTTP) 503 Service Unavailable server error response code indicates that the server is not ready to handle ...
Read more >
HTTP Status Code 503 - Service Unavailable
It usually means the server is temporarily unavailable. It's not ready to handle the request, and won't be able to process it. If...
Read more >
HTTP 503: Handling site maintenance correctly for SEO
To overcome this potential longer loss of rankings, you need to return a 503 status code whenever working on a particular page.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found