3

I want to use the maintenance mode on Heroku.

But for an API, the maintenance mode does not seem to work. My API calls are stopped in their tracks because there is no header 'Access-Control-Allow-Origin' present. So there is no way to know if the API is in maintenance mode—or if it's just not responding.

Is there a way to use the Heroku maintenance mode when the app is an API?

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Matt
  • 800
  • 1
  • 7
  • 15
  • If your application is in maintenance mode that it's not able to receive any web requests. I'm not sure I fully understand your question. – John Beynon Jun 18 '14 at 10:57
  • Well the maintenance mode serves an HTML page when you access an HTML app directly. Can't I do something similar for JSON requests from API clients? Instead of receiving a 503, the clients receive an error. – Matt Jun 18 '14 at 14:31
  • Yeah, you could use a custom maintenance page (https://devcenter.heroku.com/articles/error-codes#h17-poorly-formatted-http-response) which could return a JSON packet. – John Beynon Jun 19 '14 at 09:58

1 Answers1

1

Currently, unfortunately not. When you set a custom maintenance page it gets embedded as an iframe within a Heroku-served HTML page. As you've identified, the CORS headers are not set so your API client won't even fetch the page.

See Is there a way to have a Heroku error/maintenance url served directly without the iframe

Paul M Furley
  • 1,005
  • 1
  • 8
  • 12