server {
    listen 8080;
    error_log /var/log/nginx/error.log notice;
    rewrite_log on;
    resolver 127.0.0.1 valid=30s;
    set $flaskfetfotos flaskfetfotos:8080;
    set $etherpad etherpad:9001;
    location /assets {
             alias /app/assets;
             try_files $uri =404;
    }

    location /files {
             alias /app/files;
             try_files $uri =404;
    }
    
    location /fotos {
        proxy_ssl_server_name on;
        proxy_ssl_verify off;
        proxy_pass http://$flaskfetfotos;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        #             proxy_set_header REMOTE-USER $http_REMOTE_USER;
#             proxy_set_header X-Forwarded-User $http_REMOTE_USER;
#             proxy_set_header x-forwarded-user $http_REMOTE_USER;
        proxy_set_header Connection "upgrade";
  
    }
    
    location /etherpad {
        rewrite /etherpad/(.*) /$1 break;
        rewrite ^/etherpad$ /etherpad/ permanent;
        proxy_pass http://$etherpad;
        proxy_redirect / /etherpad/;
        proxy_set_header Host $host;
        proxy_buffering off;
    }
    
    
    location / {
        include uwsgi_params;
        uwsgi_pass unix:///tmp/uwsgi.sock;
    }
}
