Virtualhost returning strange characters?

Asked

Viewed 40 times

0

I need to access a virtual host of my machine, and of a device Android (consume a API)

When access the virtual host with the name I defined in my hosts "http://api.xpto/usuarios", I can receive the reply from API normally, but when I try to access the IP of my machine (example: http://192.168. 1.106/users), I get a reply similar to that:

E�_��l!/�Qe���b�����7�?�P�����@Gӗ(=�N��(����O�X��8���&M�8���z
���n֝�V�vq����$�`�^��� Y�z�

My file of hosts:

127.0.0.1   api.xpto
127.0.0.1   client.xpto

My virtual host:

<VirtualHost *:80>
    DocumentRoot "c:/wamp64/www/api/pubic"
    ServerName api.xpto

 ErrorLog "logs/apache_error.log"
 CustomLog "logs/apache_access.log" common

    <Directory "c:/wamp64/www/api/public">
            Order allow,deny
            Allow from all
    </Directory>
</VirtualHost>

Has anyone gone through a similar situation? I’m using Windows 10 with WAMP to the apache.

  • 1

    Virtualhost is responding to "api.xpto" because it wants to use IP?

  • @lcssanches if I try to access by 'api.xpto' on my Android device, connected on the same network, does not find the url, need to point to the IP of my machine, to find the virtual host.

  • If you have access to the router, you can try putting the "api.xpto" on the router hosts via FTP or SSH. Also check the Apache error log .

  • This putting in router hosts I usually do how much I need to do this kind of test.

1 answer

2

This looks like compressed response (probably gzip), many browsers support Gzip as response (almost all), but what happens is that in your case you must be compressing twice, or the API domain is sending compressed even when it does not send the header: Accept-Encoding

In httpd.conf comment the line, like this:

 #LoadModule deflate_module modules/mod_deflate.so

And restart the Apache

  • William, thank you for your help, that line on httpd.conf was already commented on :(

  • @mauriciocaserta tem como enviar o conteudo do httpd.conf no Pastebin? (é que ele é muito grande para postar na pergunta). I’m waiting

  • 1

    Follow the page William https://pastebin.com/KXBwfB55

  • @mauriciocaserta thanks, I’m analyzing and testing ;) ... it may take a little while because I’m having to recreate the environment the way you did to try to reproduce the problem

  • No problem, William, thanks for your help. I basically installed Wamp64 and created the virtual host, all default settings (except the display_errors I changed in php.ini) :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.