Score:0

Nginx display image as gibberish text

cn flag

I have setup to reverse proxy port 8086. Port 8086 is running a javascript that display random a image in webp format. If I try to visit the domain it displays the image as gibberish text. It works fine if I visit the ip address but not the domain.

An example of what the gibberish text looks like:

RIFFZž�WEBPVP8 Nž�ð”*€°>‘B›J%£µ0&Lr    HZÚ¯>y¦I^hwå´Ö]æåÿIßë¸WôßôœÌùo÷Oبñkóßòÿ³�?Ëÿ´qŸî°˜ßõ<ÑçµÿGÑôøB¿ãïÑÀSØþÿV\[ñïöÿ±ôÖãß
þëø¿ô¿ý=³ø›Ý>€ýæÃÿW¯ÚßÿÿþÉk=fìýÝøiûÛë7÷÷+Ý“ÕOõßRë¿õ?ÿöbz&y·÷ýëøœýâýÜÿÿïuÿÿUûáÿ÷?ðz‚øÿöÿø<ƒüŸÝãgãuܶq¿]ú÷ûâWr<}ß÷ÿòG#Ÿ<ÐwugçùõüûÏ`NþϯÐÞýÑøþ§þ¯ÖCþ1¿µÐöò÷ÿÿï÷¯ÿÿþ_ˆ?Ü£º³Y¤þ$+¤³ÿâ…€æQvË¿½ì‰Ï{’Ô˜MÛÌŽD)ñHìäÚÊgððÇܺ5²¿tlÐ;±…Ú•‰ß\vkòž‡›ú§C‘£¤_É{ÿtï¯Sßû‰38ã Å]¾á•Ö‰ä91{®9×pkáTv]NÇþ}vGŠÄƒçæG¬¯¿oZkûqœZ£>uír%‘YEbp<sUöy€våºqÀm€°]«:Ÿ„à5Ⱥµ3Axqzí$¦‘½ÀQq²Ý_•XñÆk9N~ò´>*‘`{ƒßú/BºK>P®Âœ¢Õ¤"Ò÷–«JbZ�$_×u¹öÙÍp½A¦åþiËÔg'ÊÔÝ9qàÅH¦.wØ\>¨[Ä#>½+AW‰héi_åÀ‰¥9Šzu¤«(§bc§F«à'•¡›¼W‚Nõí4íâô RšÁ‚Ÿ5qö5

Here's my nginx conf

server {


    server_name wall.example.moe www.wall.example.moe;


    access_log /var/log/nginx/wall.example.moe.access.log ;
    error_log /var/log/nginx/wall.example.moe.error.log;

    add_header X-Proxy-Cache $upstream_cache_status;
    location / {
        proxy_pass http://xxx.xxx.172.241:8086/img;
        proxy_redirect      off;
        include proxy_params;
    }

    # Security settings for better privacy
    # Deny hidden files
    location ~ /\.(?!well-known\/) {
        deny all;
    }
    # letsencrypt validation
    location /.well-known/acme-challenge/ {
        alias /var/www/html/.well-known/acme-challenge/;
        allow all;
        auth_basic off;
    }

}

Anyone know how to fix this? I just want it to display image and not gibberish text

Massimo avatar
ng flag
What are you actually trying to display? Please add URL (even anonymized) and file type/format. This looks like an Unicode mishap.
TravelWhere avatar
cn flag
@Massimo trying to display an image in webp format
Massimo avatar
ng flag
this looks like the web server and/or web browser is trying to interpreting the content as text when it's not. Have a look at mime types settings.
us flag
"It works fine if I visit the ip address but not the domain." What IP address are you referring here to? Please provide complete URL of a working and a failing request. Please also add output of `nginx -T` so we can see the full nginx configuration.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.