Traccar and redirection

samile9 years ago

Hello, first of all thank for all this good job. and sorry for my English.
I experiment a problem with Traccar 3.3. (other version was running good)
when I access Traccar via http://192.168.5.115:18021 (yes I changed the port ;-) all is good fast and no error. but when I access via my domain name http://gps.****.fr.nf I got lot of bugs.
the domain name arrive on one apache2 with this config :

<VirtualHost *:80>
        ServerName gps.****.fr.nf
        ProxyRequests On
        ProxyPreserveHost On
        ProxyVia full
        <proxy>
            Require all denied
                AuthUserFile  /www/gps.****.fr.nf/.htpasswd
                AuthGroupFile /dev/null
                AuthName "Traccar Acces Restreint"
                AuthType Basic
                require valid-user ****

        </proxy>

        ProxyPass        /  http://127.0.0.1:18021/
        ProxyPassReverse /  http://127.0.0.1:18021/
</VirtualHost>

the bugs are :
-I cannot add an device is giving me a popup with error but this popup is empty.
-I cannot logoff
-and if I logoff then I add an device the device popup is broken.

Edit: i'm on linux64 :
3.13.0-74-generic #118-Ubuntu SMP Thu Dec 17 22:52:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

if you need screenshot tell me.

my log are here for fresh install, login with admin, add try to add a device:

2015-12-23 13:26:53  INFO: Operating system name: Linux version: 3.13.0-74-generic architecture: amd64
2015-12-23 13:26:53  INFO: Java runtime name: Java HotSpot(TM) 64-Bit Server VM vendor: Oracle Corporation version: 25.66-b17
2015-12-23 13:26:53  INFO: Memory limit heap: 820mb non-heap: 0mb
2015-12-23 13:26:53  INFO: Character encoding: UTF-8 charset: UTF-8
2015-12-23 13:26:53  INFO: Version: 3.2-SNAPSHOT
2015-12-23 13:27:04  INFO: Starting server...
2015-12-23 13:27:45  INFO: Shutting down server...

STATUS | wrapper  | 2015/12/23 13:26:51 | --> Wrapper Started as Daemon
STATUS | wrapper  | 2015/12/23 13:26:51 | Java Service Wrapper Community Edition 64-bit 3.5.27
STATUS | wrapper  | 2015/12/23 13:26:51 |   Copyright (C) 1999-2015 Tanuki Software, Ltd. All Rights Reserved.
STATUS | wrapper  | 2015/12/23 13:26:51 |     http://wrapper.tanukisoftware.com
STATUS | wrapper  | 2015/12/23 13:26:51 |
STATUS | wrapper  | 2015/12/23 13:26:51 | Launching a JVM...
INFO   | jvm 1    | 2015/12/23 13:26:52 | WrapperManager: Initializing...
INFO   | jvm 1    | 2015/12/23 13:26:53 | [MLog-Init-Reporter] INFO com.mchange.v2.log.MLog - MLog clients using slf4j logging.
INFO   | jvm 1    | 2015/12/23 13:26:53 | [WrapperSimpleAppMain] INFO com.mchange.v2.c3p0.C3P0Registry - Initializing c3p0-0.9.5.2 [built 08-December-2015 22:06:04 -0800; debug? true; trace: 10]
INFO   | jvm 1    | 2015/12/23 13:26:56 | INFO 12/23/15 1:26 PM: liquibase: Successfully acquired change log lock
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: Creating database history table with name: PUBLIC.DATABASECHANGELOG
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: Reading from PUBLIC.DATABASECHANGELOG
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-normalize.xml::changelog-normalize-user::author: Marking ChangeSet: /opt/traccar/data/db.changelog-normalize.xml::changelog-normalize-user::author ran despite precondition failure due to onFail='MARK_RAN':
INFO   | jvm 1    | 2015/12/23 13:27:01 |           /opt/traccar/data/db.changelog-master.xml : Table PUBLIC.traccar does not exist
INFO   | jvm 1    | 2015/12/23 13:27:01 |
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-normalize.xml::changelog-normalize-user-device::author: Marking ChangeSet: /opt/traccar/data/db.changelog-normalize.xml::changelog-normalize-user-device::author ran despite precondition failure due to onFail='MARK_RAN':
INFO   | jvm 1    | 2015/12/23 13:27:01 |           /opt/traccar/data/db.changelog-master.xml : Table PUBLIC.traccar does not exist
INFO   | jvm 1    | 2015/12/23 13:27:01 |
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-normalize.xml::changelog-normalize-fk-h2::author: Marking ChangeSet: /opt/traccar/data/db.changelog-normalize.xml::changelog-normalize-fk-h2::author ran despite precondition failure due to onFail='MARK_RAN':
INFO   | jvm 1    | 2015/12/23 13:27:01 |           /opt/traccar/data/db.changelog-master.xml : Table PUBLIC.traccar does not exist
INFO   | jvm 1    | 2015/12/23 13:27:01 |
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-normalize.xml::changelog-normalize-fk-other::author: Marking ChangeSet: /opt/traccar/data/db.changelog-normalize.xml::changelog-normalize-fk-other::author ran despite precondition failure due to onFail='MARK_RAN':
INFO   | jvm 1    | 2015/12/23 13:27:01 |           /opt/traccar/data/db.changelog-master.xml : Table PUBLIC.traccar does not exist
INFO   | jvm 1    | 2015/12/23 13:27:01 |
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-normalize.xml::changelog-normalize-fk::author: Marking ChangeSet: /opt/traccar/data/db.changelog-normalize.xml::changelog-normalize-fk::author ran despite precondition failure due to onFail='MARK_RAN':
INFO   | jvm 1    | 2015/12/23 13:27:01 |           /opt/traccar/data/db.changelog-master.xml : Table PUBLIC.traccar does not exist
INFO   | jvm 1    | 2015/12/23 13:27:01 |
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-normalize.xml::changelog-normalize-fk-data-other::author: Marking ChangeSet: /opt/traccar/data/db.changelog-normalize.xml::changelog-normalize-fk-data-other::author ran despite precondition failure due to onFail='MARK_RAN':
INFO   | jvm 1    | 2015/12/23 13:27:01 |           /opt/traccar/data/db.changelog-master.xml : Table PUBLIC.traccar does not exist
INFO   | jvm 1    | 2015/12/23 13:27:01 |
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-normalize.xml::changelog-normalize-fk-data::author: Marking ChangeSet: /opt/traccar/data/db.changelog-normalize.xml::changelog-normalize-fk-data::author ran despite precondition failure due to onFail='MARK_RAN':
INFO   | jvm 1    | 2015/12/23 13:27:01 |           /opt/traccar/data/db.changelog-master.xml : Table PUBLIC.traccar does not exist
INFO   | jvm 1    | 2015/12/23 13:27:01 |
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.0.xml::changelog-3.0::author: Table user created
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.0.xml::changelog-3.0::author: Table device created
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.0.xml::changelog-3.0::author: Table user_device created
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.0.xml::changelog-3.0::author: Foreign key constraint added to user_device (userId)
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.0.xml::changelog-3.0::author: Foreign key constraint added to user_device (deviceId)
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.0.xml::changelog-3.0::author: Index user_device_user_id created
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.0.xml::changelog-3.0::author: Table position created
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.0.xml::changelog-3.0::author: Foreign key constraint added to position (deviceId)
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.0.xml::changelog-3.0::author: Table data created
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.0.xml::changelog-3.0::author: Foreign key constraint added to data (deviceId)
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.0.xml::changelog-3.0::author: Table server created
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.0.xml::changelog-3.0::author: Table traccar created
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.0.xml::changelog-3.0::author: New row inserted into server
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.0.xml::changelog-3.0::author: New row inserted into user
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.0.xml::changelog-3.0::author: ChangeSet /opt/traccar/data/db.changelog-3.0.xml::changelog-3.0::author ran successfully in 235ms
INFO   | jvm 1    | 2015/12/23 13:27:01 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.1.xml::changelog-3.1::author: Null constraint dropped from user.name
INFO   | jvm 1    | 2015/12/23 13:27:02 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.1.xml::changelog-3.1::author: user.name datatype was changed to VARCHAR(128)
INFO   | jvm 1    | 2015/12/23 13:27:02 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.1.xml::changelog-3.1::author: Null constraint has been added to user.name
INFO   | jvm 1    | 2015/12/23 13:27:02 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.1.xml::changelog-3.1::author: Null constraint dropped from user.email
INFO   | jvm 1    | 2015/12/23 13:27:02 | INFO 12/23/15 1:27 PM: liquibase: /opt/traccar/data/db.changelog-master.xml: /opt/traccar/data/db.changelog-3.1.xml::changelog-3.1::author: user.email datatype was changed to VARCHAR(128)
....
INFO   | jvm 1    | 2015/12/23 13:27:03 | INFO 12/23/15 1:27 PM: liquibase: Successfully released change log lock
INFO   | jvm 1    | 2015/12/23 13:27:03 | [WrapperSimpleAppMain] INFO com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> z8kfsx9d1ldqbih10vf31o|19389d06, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> org.h2.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> z8kfsx9d1ldqbih10vf31o|19389d06, idleConnectionTestPeriod -> 600, initialPoolSize -> 3, jdbcUrl -> jdbc:h2:/opt/traccar/data/database, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> true, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
INFO   | jvm 1    | 2015/12/23 13:27:03 | [WrapperSimpleAppMain] INFO org.eclipse.jetty.util.log - Logging initialized @11496ms
INFO   | jvm 1    | 2015/12/23 13:27:04 | [WrapperSimpleAppMain] INFO org.eclipse.jetty.server.Server - jetty-9.2.14.v20151106
INFO   | jvm 1    | 2015/12/23 13:27:07 | [WrapperSimpleAppMain] INFO org.eclipse.jetty.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@792fcac3{/api,null,AVAILABLE}
INFO   | jvm 1    | 2015/12/23 13:27:07 | [WrapperSimpleAppMain] WARN org.eclipse.jetty.server.handler.AbstractHandler - No Server set for org.traccar.web.WebServer$1@512e93b2
INFO   | jvm 1    | 2015/12/23 13:27:07 | [WrapperSimpleAppMain] INFO org.eclipse.jetty.server.ServerConnector - Started ServerConnector@516e92b8{HTTP/1.1}{0.0.0.0:18021}
INFO   | jvm 1    | 2015/12/23 13:27:07 | [WrapperSimpleAppMain] INFO org.eclipse.jetty.server.Server - Started @15703ms
STATUS | wrapper  | 2015/12/23 13:27:44 | TERM trapped.  Shutting down.
INFO   | jvm 1    | 2015/12/23 13:27:45 | [Thread-15] INFO org.eclipse.jetty.server.ServerConnector - Stopped ServerConnector@516e92b8{HTTP/1.1}{0.0.0.0:18021}
INFO   | jvm 1    | 2015/12/23 13:27:45 | [Thread-15] INFO org.eclipse.jetty.server.handler.ContextHandler - Stopped o.e.j.s.ServletContextHandler@792fcac3{/api,null,UNAVAILABLE}
STATUS | wrapper  | 2015/12/23 13:27:45 | <-- Wrapper Stopped
Anton Tananaev9 years ago

Please provide some screenshots with error messages.

samile9 years ago

Hello Anton, thx for your fast response and your helping. here you have the two screenshot:

here after add an device :
https://app.box.com/s/fypkzkxykuspxsdhx1xd2swmfhr9saii

here after logoff (not come back to login panel) and click on add device :
https://app.box.com/s/4ls6m92wso4lfcmkglpxagj1t9lh7p8w

And sorry for the delay of my response.

Thx.

Anton Tananaev9 years ago

I would recommend to clear browser cache and see if it helps. Also, check browser developer console to see if there are any errors there.

samile9 years ago

Hello clear cache not helped. but some errors on debug console :
Firefox ne peut établir de connexion avec le serveur à l'adresse ws://gps..fr.nf/api/socket.
Firefox cannot connect to server at the address ws://gps.
.fr.nf/api/socket.
the error is in : app.min.js:87:24

Anton Tananaev9 years ago

Version 3.3 uses WebSockets, so you need to proxy it as well.

samile9 years ago

hello, hoo ok, then do you have an idea on how forward ws with apache2 server. Coz I try to add this line :
ProxyPass "/ws2/" "ws://127.0.0.1:18021/"
or
ProxyPass "/ws/" "ws://127.0.0.1:18021/"
or
ProxyPass "/api/" "ws://127.0.0.1:18021/"
but no one is working.

can you help me?

thx in advance.

EDIT : I get new error on :
ProxyPass "/api/" "ws://127.0.0.1:18021/api/"
https://app.box.com/s/yhw4ugpmmu0237vzqx5q7982bhz6726g

Please help.

samile9 years ago

re-Hello, with this :

ProxyPass / ws://127.0.0.1:18021/
ProxyPassReverse / ws://127.0.0.1:18021/
ProxyPass / http://127.0.0.1:18021/
ProxyPassReverse / http://127.0.0.1:18021/

I think is working but still get the device error.
Screenshot

Sorry, and have a good Christmas ;-)

Anton Tananaev9 years ago

It looks like there is some problem with authorization. I guess proxy doesn't handle headers correctly.

samile9 years ago

Hello guys,
I do a little up, coz I didn't found any solution.
I have play with some setting in apache 2 conf file but without success.

like :
ProxyRequests On
ProxyPreserveHost On
ProxyVia Full

if any one have the solution or an idea please share it.

Thx.

Anton Tananaev9 years ago

Are you using "mod_proxy_wstunnel" Apache module?

This also might be helpful (it's for nginx though):

https://www.traccar.org/forums/topic/3-3-and-no-last-position-on-map/

samile9 years ago

hello,
yes I use "mod_proxy_wstunnel" :
ls /etc/apache2/mods-enabled/
... proxy_wstunnel.load ...
cat /etc/apache2/mods-enabled/proxy_wstunnel.load

Depends: proxy

LoadModule proxy_wstunnel_module /usr/lib/apache2/modules/mod_proxy_wstunnel.so

I will try to force http version to 1.1 like in ngix conf file and this option (but I don't know equivalent in apache then I will search)
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_buffering off;
proxy_redirect off;

and maybe the include subfolder in the header.
thx for new way to look for.
I will be back ;-)