v.5.5 modern interface error: 403 Forbidden

mbodea20072 years ago

Hi. I've upgraded from 4.15 to 5.5, compiled server, /web and /modern. All works, except modern interface:
With "npm start" development build will show up on port 3000, but with npm run build will always run into 403 forbidden error on port 8082
Legacy interface works fine after changing to <entry key='web.path'>./web</entry>.
Problem is I can't find where to look for the errors. Nothing showing in tracker-server.log, except for :
"WARN: JAXBContext implementation could not be found. WADL feature is disabled." - which does not seems to be related..
npm and nvm installed as sudo user (Centos 7)
all npm commands run from /modern folder
modern/.env :

ESLINT_NO_DEV_ERRORS=false
REACT_APP_URL_NAME='localhost:8082'
REACT_APP_VERSION=$npm_package_version
npm -v:  8.1.0
nvm -v:  0.39.0
node -v: 17.0.0 (will throw errors for higher node)  

More likely a server config thing, but after 2 days , I still can't find it...
Thx

Anton Tananaev2 years ago

Do you get the error even with the official version? Or only if you compile it yourself?

mbodea20072 years ago

Hi Anton,
It is the official version:
I have downloaded from here, uploaded to my /modern folder, then tried to use node 18.12.1 but with npm install I get:

npm install
node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by node)
node: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by node)
node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by node)
node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by node)

so I switch back to node 17.9.1 , run npm install I get:

npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
added 1721 packages, and audited 1722 packages in 25s
..
10 high severity vulnerabilities

(any issue here?)

with npm start I get

Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
then in .eslintrc.js  I add in rules: { 
    'linebreak-style': ['error', process.env.NODE_ENV === 'prod' ? 'unix' : 'windows'],

npm start again, and now I can access the development build on port :3000
But after npm run build (I get a warn : browserlist caniuse-lite is outdated ...)

Browserslist: caniuse-lite is outdated. Please run:
  npx browserslist@latest --update-db
  Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
Compiled successfully.

File sizes after gzip:

  922.39 kB  build/static/js/main.c4a1de88.js
  17.19 kB   build/static/css/main.967cebd1.css

The bundle size is significantly larger than recommended.
Consider reducing it with code splitting: https://goo.gl/9VhYWB
You can also analyze the project dependencies: https://goo.gl/LeUzfb

The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.
.....

but I can't access on port 8082: I get 403 Forbidden error.
May be due to some node package restrictions?

Thx,
Marius

Anton Tananaev2 years ago

By official version I meant the installer, not the source code.

mbodea20072 years ago

Hi.
... hm it works with the installer, (It's missing start script in /modern but not a big deal.)
(on installer, legacy version is under /legacy forlder, while on source code it is still under /web - again, not big deal)

I found the issue: it will work with

<entry key='web.path'>./modern/build</entry>

instead of

<entry key='web.path'>./modern</entry>

in traccar settings...
Not sure if does not affect other things, but it works now...
Thx.

Anton Tananaev2 years ago

Seems like you've made an assumption that folders in the source code should match the folders in the installer. That is not the case.

mbodea20072 years ago

Hi,
except for settings from https://www.traccar.org/secure-connection/ what other settings you need to change to have modern interface show in example.com/gps/ instead of example.com:8082 ?

Anton Tananaev2 years ago

At least you would have to recompile the app with the different path. I would strongly recommend using a subdomain instead. Much easier.

mbodea20072 years ago

Hi,
can you please detaill how these settings (from https://www.traccar.org/secure-connection/ ) will change , for a subdomain like https://gps.example.com

ProxyRequests off

ProxyPass /gps/api/socket ws://localhost:8082/api/socket
ProxyPassReverse /gps/api/socket ws://localhost:8082/api/socket

ProxyPass /gps/ http://localhost:8082/
ProxyPassReverse /gps/ http://localhost:8082/
ProxyPassReverseCookiePath / /gps/

Redirect permanent /gps /gps/

Thx

Anton Tananaev2 years ago

For the subdomain you just ignore the "Traccar in subdirectory" section.

mbodea20072 years ago

Hi,
it is not OK, because I need to keep the wordpress website under example.com , but with

                ProxyPass / http://localhost:8082/
                ProxyPassReverse / http://localhost:8082/

the example.com is redirected to gps.example.com

Anton Tananaev2 years ago

That's not how it works. You need to do a bit more research on virtual hosts. Your configuration should only apply to gps.example.com, not to example.com.

mbodea20072 years ago

OK. I've sort it out.
All works now under subdomain.
Thx.

Jose2 years ago

when substituting the moderm folder compiled on my local server for the moderm folder on my vps I get: "403 - Forbidden" I read above and changed in the default.xml

<entry key='web.path'>./modern/build</entry>
instead of
<entry key='web.path'>./modern</entry>

this didn't work for me either. any suggestions?

Anton Tananaev2 years ago

You don't substitute modern folder from the source code. You take the build output and replace the installed version with it.