Traccar Proxy Websocket Connection Error

davidias7 years ago

I'm using this script to redirect to the tracccar, it works fine, however, after I start using it the message appears websocket connection error.

<VirtualHost *:80>

    # Altere o email do administrador.
    ServerAdmin hostmaster@example.com
    ProxyRequests off
    DocumentRoot /var/www
    ProxyPreserveHost On

    # Altere a URL que vai ser usada
    # para acessar o site
    ServerName http://45.XX.XX.25

    # Caso mais de uma URL for usada,
    # adicione as outras aqui, uma em
    # cada linha.
    #ServerAlias www.example.com

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # Alguns possíveis valores: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel error

    <Location />
        # Configure aqui a URL do site que se quer acessar.
        ProxyPass http://45.XX.XX.25:8082/
        ProxyPassReverse http://45.XX.XX.25:8082/
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>
Anton Tananaev7 years ago
davidias7 years ago

I've tried, but it's not a case, and it's for anyone who wants to use ssl. I want to do the redirect without ssl.

Anton Tananaev7 years ago

Obviously you have to skip anything related to SSL, but the information on how to proxy WebSocket connection is there.

davidias7 years ago

Thank you for your help ....
It worked fine using it like that.

<VirtualHost *:80>

            ServerName 45.xx.xx.25
            ServerAdmin webmaster@localhost

            DocumentRoot /var/www/html

            ProxyPass /api/socket ws://45.xx.xx.25:8082/api/socket
            ProxyPassReverse /api/socket ws://45.xx.xx.25:8082/api/socket

            ProxyPass / http://45.xx.xx.25:8082/
            ProxyPassReverse / http://45.xx.xx.25:8082/
            

</VirtualHost>

Unfortunately PHPMYADMIN can no longer be accessed by ip/phpmyadmin.

Anton Tananaev7 years ago

The path is missing. Also, have you enabled all required modules in Apache?