Nginx [SOLVED]: Python, uWSGI, NGINX, FLASK works on WiFi does not over cellular

Nginx [SOLVED]: Python, uWSGI, NGINX, FLASK works on WiFi does not over cellular

Home Forums Nginx Nginx [SOLVED]: Python, uWSGI, NGINX, FLASK works on WiFi does not over cellular

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36719

    Anonymous

    QuestionQuestion

    I’m using a Digital Ocean server to run a personal website. The site works perfectly and I’m happy with it. I was able to get Lets Encrypt set up and working too (this problem existed before setting up Lets Encrypt).

    Over WiFi. Over a cellular network the site doesn’t load. But if I switch my phone to WiFi, it works fine. I have literally no idea what is causing this issue.

    My set up is very standard, Python and flask, served by nginx and uWSGI. Everything was set up using this tutorial. I am happy to post nginx config, uwsgi config, etc, and all source for the site is here.

    UPDATE

    This issue is caused by a bug in certbot, which doesn’t handle IPV6 when used on NGINX. This can be fixed by editing the NGINX config and adding the lines in Wander Nauta’s answer.

    #36720

    Anonymous

    Accepted AnswerAnswer

    Your website has both an IPv4 and an IPv6 address:

    $ dig +short A njw.fish
    138.197.30.136
    
    $ dig +short AAAA njw.fish
    2604:a880:800:10::20c1:d001
    

    This is great, but it seems nginx is only listening on the IPv4 address. Instruct it to listen on both:

    listen [::]:443 ssl;  # For IPv6
    listen 443 ssl;       # For IPv4
    

    Likely, your cell phone uses the (newer) IPv6, while your WiFi uses the (older) IPv4.

    Source: https://stackoverflow.com/questions/47981630/python-uwsgi-nginx-flask-works-on-wifi-does-not-over-cellular
    Author: Wander Nauta
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.