frontend icon indicating copy to clipboard operation
frontend copied to clipboard

Vue.js / Application urls are not working properly behind a reverse proxy with a context path (context path is duplicated)

Open lsauer opened this issue 2 years ago • 3 comments

The application is running on the path /dtrack/. Since almost all content is created by vue.js on the clientside rather on the server side, rewriting urls with the reverse proxy is quite futile.

The situation is as follows. the app is started from dtrack, but the js, etc resources are loaded from the root: image

Current Behavior:

When hovering over a component in Home > Project > <PROJECTNAME> the url appears correct image

image The same misbehaviour is also true for the tags image

The url is set in the DOM as ../dtrack/hash , which in principle is correct. However vue.js clearly has a event-handler on the element to route it and the router is forwarding to

basedomain/dtrack/dtrack/hash with a 404 image

/components may also be affected. I cannot test this right now.

Steps to Reproduce:

See above. Clicking the link

Expected Behavior:

opening the same url as indicated by the browser url preview at the bottom-left.

Environment:

  • Dependency-Track Version: 4.5
  • Distribution: Docker
  • BOM Format & Version: -
  • Database Server: H2
  • Browser: Chrome, Firefox latest

Additional Details:

The context path has to be set in vue.js It has a function getContextPath

Since most of the UI's urls actually work I am assuming this is a small bug of this particular 'project' Router/Controller Configuration.

It would help tremendously if all the js,static,css etc... could be moved into ONE unique path, called dtrack for everyone. There are few downsides, but many upsides.

The Eventlistener is here in App.vue:

It is pushed to the router, where I guess it is filtered out as a non App-native link because Vue.js does not have a basepath

image

I just saw, this was hinted here: https://github.com/DependencyTrack/dependency-track/discussions/1831#discussioncomment-3260735

lsauer avatar Jul 27 '22 14:07 lsauer

Related to https://github.com/DependencyTrack/frontend/issues/153.

As mentioned in https://github.com/DependencyTrack/dependency-track/discussions/1831#discussioncomment-3260735, it's kind of a known issue, but we didn't have the time to look into it yet. If you'd like to contribute a fix, I think you'd make lots of other folks really happy!

nscuro avatar Jul 27 '22 18:07 nscuro

Related to #153.

As mentioned in DependencyTrack/dependency-track#1831 (reply in thread), it's kind of a known issue, but we didn't have the time to look into it yet. If you'd like to contribute a fix, I think you'd make lots of other folks really happy!

The bug may only presents itself in the custom Project-controller , and you considered that if the basePath is kept relative than everything may work. Could you revisit the issue of a empty built-time basePath. https://github.com/DependencyTrack/frontend/issues/153#issuecomment-1137235933

All other controllers seam fine. Generally speaking it would help a lot for the folks using reverse proxies if all the resources of the frontend like js/, css/, static/ could be moved behind a common path like dtrack/js, dtrack/css. Is that something you would be willing to consider?

lsauer avatar Aug 04 '22 07:08 lsauer

I'm running into this issue as well. Would like to run this behind a reverse proxy but status prefetch content is not being handled appropriately.

jeremytbrun avatar Feb 12 '24 20:02 jeremytbrun

Implemented in https://github.com/DependencyTrack/frontend/pull/801

nscuro avatar Sep 22 '24 10:09 nscuro