-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Bug]: Service Worker preventing correct execution of bootstrap when using NGINX reverse proxy #2793
Comments
I was just having a similar issue setting up my reverse proxy for a VPN tunnel for my own setup, can you share a redacted copy of your NGINX configuration file for this site (and the regular |
nginx.conf*** error_log /var/log/nginx/error.log; pid /run/nginx.pid; events { http {
} ssl_settings.conf******* server {
} Mutual TLS redirect for Actualserver {
} |
Is there a particular requirement for predetermining the default |
Here's more specifically about the |
Thank you so much for taking a look. Will try to implement and see if it helps.
…On June 8, 2024 9:15:30 PM EDT, safehome-jdev ***@***.***> wrote:
[Here's more specifically about](https://nginx.org/en/docs/http/ngx_http_core_module.html#default_type) the `default_type` module.
--
Reply to this email directly or view it on GitHub:
#2793 (comment)
You are receiving this because you authored the thread.
Message ID: ***@***.***>
|
I have a similar problem. My problem is that I am reverse proxying and using authentik as SSO. When authentik login session expires, actual breaks, I suppose because the service worker bypasses the reverse proxy. I got around this, by updating my reverse proxy with a directive that responds to the path /registerSW.js with a 404. This prevents the service worker from ever starting. Obviously this is not ideal, as now actual will not work without an internet connection. But at least without the service worker, the application will redirect me to my SSO instead of breaking. |
@Towerism Are you able to post your NGINX config for this? As well as any browser errors/failure responses from your browser's console and network tools for when a login expires? A quick search shows that workers do not retry upon failure, which checks out so far. |
Sure I’d be happy to. ’m using caddy which has a lot going on in it due to
other stuff that I’m hosting. I’ll take some time to put together a more
minimal docker compose and caddy file and share it here.
…On Sun, Jun 23, 2024 at 01:32 safehome-jdev ***@***.***> wrote:
I have a similar problem. My problem is that I am reverse proxying and
using authentik as SSO. When authentik login session expires, actual
breaks, I suppose because the service worker bypasses the reverse proxy.
I got around this, by updating my reverse proxy with a directive that
responds to the path /registerSW.js with a 404. This prevents the service
worker from ever starting.
Obviously this is not ideal, as now actual will not work without an
internet connection. But at least without the service worker, the
application will redirect me to my SSO instead of breaking.
@Towerism <https://github.com/Towerism> Are you able to post your NGINX
config for this?
—
Reply to this email directly, view it on GitHub
<#2793 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPWJUUQV45ORBLNIVFTVXDZIZTWDAVCNFSM6AAAAABIF4CKOWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBUGY3TQMZTGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@safehome-jdev, when my auth endpoint is queried via fetch, it is giving cors errors. So it seems that the error is something I should be able to work out on the authentik configuration side. |
Ah, you'll need to add something like the following to allow auth requests from your domain name to Authentik's auth servers:
Change the asterisk in |
@safehome-jdev I could try that, but I believe what's going on is that the fetch to /authorize results in a redirect, so the preflight request has ERR_INVALID_REDIRECT. So authentik is expecting the application to navigate to the authorize url rather than make an XHR request. I think? |
@safehome-jdev i was able to get caddy to handle cors properly. However, this didn't fix the issue that with authentik configured in caddy using forward_auth, actual tries to use an XHR request instead of navigating. Error from service worker in the console:
|
@safehome-jdev I just realized what's happening. i have caddy configured to redirect to authentik. the service worker is serving the page, completely bypassing caddy. in this case, the service worker tries to authenticate with actual-server but is redirected to authentik instead since the cookie expired. I think I just have to disable the service worker in my case in order to have authentik work correctly. |
@Towerism were you able to solve the issue you have with authentik? I have the same issue. Using actual budget with Nginx Proxy Mnager and Authentik. If yes, could you explain how? |
@mdelpire i did not solve this directly. I’m using a workaround currently where I intercept the request to load the service worker and return a 404 not found. |
While not directly related to this issue, I was also able to get the "Sign Out" button to actually sign me out of Authentik by replacing
And then using it with the following location directive in nginx:
I imagine there's a better way to do this by building actual myself, but this is a quick fix for me. |
I've opened #3286 with a workaround for this. |
Just updated to 24.10.1 which includes #3286 and still seem to experiencing the same issue. Did some quick digging and it seems like this kcab.worker.js script is attempting to pull from /sync but it isn't reloading. Manually calling the reload code from that PR from the console does work, meaning that there are probably some other places that need to be hooked with the force reload code. |
I can't seem to reproduce this. Mine is now refreshing correctly when sync is redirected. Are you sure your client has updated and is using the new version? Try clearing caches and refreshing. |
Pretty sure it was. I've since disabled the sw again using nginx rules, but I had checked the mangled sources in Firefox and could see it was the updated version. |
Verified issue does not already exist?
What happened?
Thank you for developing this fantastic project! However, I've encountered a problem with the service worker when passing the connection through an nginx reverse proxy. When the server is accessed directly, everything functions without issues. However, when the connection is proxied, the resources load, but the loading script fails to start. If the sw.js is unregistered, the page then loads correctly.
Where are you hosting Actual?
Docker
What browsers are you seeing the problem on?
Chrome, Microsoft Edge, Desktop App (Electron), Other
Operating System
Windows 10
The text was updated successfully, but these errors were encountered: