divolte / divolte-collector

Divolte Collector
https://divolte.io/
Apache License 2.0
283 stars 78 forks source link

When location of tracking script is changed in config the static test page cannot find the divolte.js script #168

Open krisgeus opened 7 years ago

DaveSlinn commented 4 years ago

I know this is a really old issue, but it is still open.

We are encountering the same issue. We are overriding the javascript name and when we his the test page, it is still looking for divolte.js. I found an old PR #137 that seems to change the code from using the configured script to a hard coded string of "divolte.js". Is this the reason? If I open a PR and change this line (https://github.com/divolte/divolte-collector/blob/e6b72694a12c3cce72ad3d05d40737b59a8d329e/src/main/java/io/divolte/server/js/TrackingJavaScriptResource.java#L80) back, will that break what PR 137 was fixing?

friso commented 4 years ago

I am not sure that is related. As far as I know the test page is a static resource and is just served as is. It is not dynamically generated and as a result does not support any other name than the hardcoded one. To the best of my recollection we decided not to change that, because the test page was built mostly for the purpose of supporting the tutorial and not so much a production use case.

If you are deploying Divolte behind a L7 load balancer of some sort, a possible workaround is to add a static test page to the load balancer config that includes the correct script.

friso commented 4 years ago

See here. Also note that the page includes a CDN-ed Bootstrap which may not be ideal to host, since it never sees an upgrade.

DaveSlinn commented 4 years ago

Are you saying that the collector we deployed to production should not have that test page? How would I remove it, without altering the source code and building a new container? Our current container is based off divolte/divolte-collector:latest on docker hub, that we add our own config to.

Personally, I find that test page is very handy to make sure I have all the proper ingress routing correctly to reach my collector pods, and that the signal callbacks are properly reaching kafka. We just encountered this issue because we have changed the name of the script to prevent ad-blocking software from blocking it, which uBlock Origin was doing. I can still reach the test page, but because the script name changed, the callback signals are not working.

I will look at building my own host test page to work with, but I would vote to keep the test page available, but have it use the actual collector js file, if renamed.

friso commented 4 years ago

The test page isn't necessarily harmful, but yeah, I wouldn't leave it exposed per se, as it might accidentally get indexed into search engines or something like that.

You can disable serving the static page through a configuration option.