Closed ybbih closed 3 weeks ago
I'm a little confused because the extensions show "Connection failed", but your screenshot show that the request (/my/accounts.json) was successful (200 OK). The label of the connection state indicates whether the request (/my/accounts.json) was successful or not.
In version 1.17.0
I added a reqest header to disable the cache for api requests, so that the request should no longer cached by the browser. I cache most of the data internally. When you save the settings, the internal cache will be deleted.
Hint: You do not need to edit the connection link, simply save settings
Is the problem still present? Is it enough to clear the internal cache (save settings to clear)? And if you refresh the page or reopen the popup, does that solve the issue? And if the connection has failed, does the extension make further requests when you switch between settings and issues tab?
Please provide more information so that I can help you.
To make it easier for you to investigate, I'd recorded a video and I've uploaded it to Youtube.
Simulation begins with me being connected to the VPN (of which target redmine is behind). Plugin works fine. Disconnect from VPN changes connection status to "failed" which is fine - what I couldn't record and what often happens (actually, during recording I have NOT encountered it for the very first time) is that the Issues tab doesn't show up - it's blank. Then I've reconnected with the VPN (redmine started to be accessible for me) but refreshing, turning off / on the plugin didnt' change the connection status at all. Even though there was a 200, it looked like the connection was cached (look at the timestamp (ignore 2-hours difference between GMT and CET)). Manual browser cache clearing through devtools resolves the issue.
Video available here: https://www.youtube.com/watch?v=vEINTiGFelE
I have tested the extension against a redmine instane behind a VPN and I have also tested it under linux. Both worked well for me. It seems to be a very specific problem.
You could try the following 3 scenarios:
Could you try this test version redmine-time-tracking-v1.17.1-test.zip (download). This version tries to reconnect to the Redmien every 3 seconds and I have added the error reason below.
If you reconnect to your VPN and the connection status is "Connection failed", please clear your browser cache and reload the extension page with F5. Please do not make any changes in the settings only reload page or reopen popup. Does it work again afterwards?
Another attempt is to disable the browser cache. Does that work?
Clearing cache helps but it can be partially applied since i have no Network Error but not pretty error message.
Network Error happened only when I turned off NIC
To specify, I'm not sure if your plugin is ready for 403 error - maybe that's the case? Cause the response is there, even without VPN. But the access is blocked.
The problem is that your Redmine instance (or whatever is in front of your Redmine instance) is not actually returning a 403
. The response code is 200
, but with content that reads 403.
I have added a check that throws an error if the content-type is not application/json
. Available in the new version v1.17.0
.
I appreciate your efforts but it doesn't fully resolve the issue.
I can confirm it tries to reconnect when swapping tabs and it does work indeed and connects succesfully but only with Disable cache tick in DevTools checked. When unchecked, it fails at Invalid content-type 'text/html'. Expected 'application/json'.
DevTools Network tab says it's 200 OK (from disk cache)
.
As for now, I have instructed my team to clear cache when switching networks and we will see if it helps. I will come back to you later this week.
Due to the status code 200, the browser has cached this ‘fake error’ response. After reconnecting to your network, the browser returns the cache response with the error. If your service returns a real 403, this should no longer be a problem.
I replied earlier that the browser should no longer caches responses, but that was incorrect. I have now fixed this issue. This should solve the last part of the problem and cover similar problems in the future.
This fix will deployed with the next release.
Nevertheless, after your suggestion, we'd added a proper 403 error from the service and it seems like it works great now. Thank you for your help!
I'm glad to hear that.
Thank you for reporting this bug and helping me to improve this extention
I would like to report a bug when we try to report to Redmine, which is behind a VPN.
When we switch Wi-Fi networks (a situation that occurs when we work in the field or simply switch to another network within the building), the plugin breaks the connection with RDM and is unable to reconnect. It seems like it has the existing connection saved in the cache and does not allow creating a new one.
In the Options, there is a message "Connection failed" and the "Issues" tab does not open at all.
After entering the dev tools and selecting "Clear browser cache", then re-entering plugin Settings, editing the Redmine connection link, and saving the configuration, the connection is established correctly.