Django messages are not shown if chrome data saver is enabled

114 Views Asked by At

Google data saver compresses data to reduce traffic usage. It is enabled by default in mobile (android) chrome and might be used in desktop chrome as plugin.

Whe GDS is on django messages are NOT displayed.

I created a sample application (Python 3.5, Django 1.10.8, uwsgi+nginx) to catch this bug. This app has one "submit" button on main page that triggers the view method:

def welcome_view(request):
    if request.method == 'POST':
        messages.add_message(request, messages.INFO, "succeed")
        return HttpResponseRedirect('/')
    else:
        return render(request, 'index.html')

Full app sources are here.

Deployed application available at fqtest.ru

Steps to reproduce:

  1. Deploy to some server (or use mine fqtest.ru). Don't forget to specify allowed hosts in settigs.py.
  2. Turn off chrome data saver plugin if you have it or use launch ingognito mode.
  3. Open main page and click Go bitton. Result: message shown as expected
  4. Turn on data saver plugin or install it (or open site from android chrome)
  5. Open main page and click Go bitton. Result: message NOT shown while it should be.

Questions:

  1. What are reasons of this behavior?
  2. How can it be fixed/worked around?

Hope for help. Thanks!

0

There are 0 best solutions below