Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is ALLOWED_HOSTS needed on Heroku?

From what I understand, ALLOWED_HOSTS does a check when DEBUG=False to prevent an attacker from pointing their own domain to your site.

It looks like Heroku's Custom Domains do the same thing.

So instead of adding a required ALLOWED_HOSTS variable in your app.json for the Heroku Button (since it feels redundant and is error-prone when you're in a hurry), can you set ALLOWED_HOSTS = ['*'] and allow Heroku to verify the requests are coming where they should instead?

like image 751
Joe Avatar asked Jul 28 '15 19:07

Joe


People also ask

What is a Procfile in Django?

The basics. First, and most importantly, Heroku web applications require a Procfile . This file is used to explicitly declare your application's process types and entry points. It is located in the root of your repository. Procfile web: gunicorn myproject.wsgi.

What is Django_heroku?

Project description. This is a Django library for Heroku applications that ensures a seamless deployment and development experience.


1 Answers

Note that Heroku removed ['*'] from the getting started guide in December 2017.

I recommend setting ALLOWED_HOSTS = ['.herokuapp.com'].

Even though Heroku's domain service is providing this protection, specifying the setting will be a reminder to update the configuration if moved to another hosting service.

like image 154
Charlie Weems Avatar answered Oct 10 '22 23:10

Charlie Weems