'nginx svelte django(waitress) external ip no response

I have the following nginx configuration:

// nginx.conf
server {
  listen       8888;
  server_name  xxx.xx.xxx.xx; // my PC's external ip 
  root         html;
}

and I'm running a django/waitress server on xxx.xx.xxx.xx:8072

This is my svelte code fetching data from the django server

const res = await fetch(`http://xxx.xx.xxx.xx:8072/myapp/`);

I built this svelte app and copied the content of the public folder to nginx/html and ran nginx. 'http://xxx.xx.xxx.xx:8888/myapp' gives me no response from the django server.

However, if I fetch from 'localhost:8072' and run the django server on locahost:8072, and configure nginx with server_name 'localhost', this work properly.

Why is this not working with an external IP?

Sorry for my poor English.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source