Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run from custom root path #2032

Closed
pengc99 opened this issue Jun 19, 2016 · 8 comments
Closed

Cannot run from custom root path #2032

pengc99 opened this issue Jun 19, 2016 · 8 comments

Comments

@pengc99
Copy link

pengc99 commented Jun 19, 2016

Trying to setup a Traccar instance on my Apache2 server - I can not use the root location for the application, and the application must run from either port 80 or 443 (HTTP or HTTPS).

I have read the instructions on how to setup with an HTTPS reverse proxy using Apache2, but this assumes using the default root path.

I'm trying to run the application from another root path, such as /traccar

Attempting to use /traccar in the ReverseProxy configuration results in numerous 404 errors. Digging through the source code, I could not find any configuration to set the root path as the application assumes it is running from /

@pengc99
Copy link
Author

pengc99 commented Jun 19, 2016

https://www.eclipse.org/jetty/documentation/9.3.x/configuring-contexts.html

This might have more information on setting a contextpath

@tananaev
Copy link
Member

Traccar is not a web app. It's a system service. Can you run those?

@pengc99
Copy link
Author

pengc99 commented Jun 19, 2016

Yes, I can get it all to run perfectly from the root path, just not a custom contextpath

@tananaev
Copy link
Member

You might need to modify some paths. For example here:

https://github.com/tananaev/traccar/blob/master/web/app/store/AllDevices.js#L23

Alternatively you can keep /api at the top level. I think it should work that way.

@pengc99
Copy link
Author

pengc99 commented Jun 20, 2016

Yes I think /api can be the same because it's just for the websocket right? I only intend to have one websocket application. Let me try that out and see how it works.

@tananaev
Copy link
Member

It's for WebSockets and REST API.

@pengc99
Copy link
Author

pengc99 commented Jun 20, 2016

I was able to get it to work with the following apache2 configuration:

    # Proxy section for Traccar API
    <Location /api>
    ProxyPass http://localhost:8082/api
    ProxyPassReverse http://localhost:8082/api
    </Location>

    # Proxy section for Traccar API websocket
    <Location /api/socket>
    # Reverse Proxy
    ProxyPass ws://localhost:8082/api/socket
    ProxyPassReverse ws://localhost:8082/api/socket
    </Location>

    # Proxy section for Traccar
    <Location /traccar>
    ProxyPass http://localhost:8082/traccar
    ProxyPassReverse http://localhost:8082/traccar
    </Location>

I then had to move everything in the web directory to /traccar

I also needed to edit locale.js and edit line 72 to add the new path:

    url: '/traccar/l10n/' + Locale.language + '.json',

This allows the application to load at my domain name as:
http://mydomainname/traccar

@tananaev
Copy link
Member

Thanks for sharing the info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants