Issue Search Confirmation
Bug Description
Offline mode and PWA browser installation fail out-of-the-box due to a service worker scope restriction.
Current SW Location: /assets/pos_next/pos/sw.js
POS App Route: /pos
Because the service worker is nested inside the assets directory, browsers restrict its security scope. It cannot intercept network requests or cache assets for the /pos page, rendering offline mode completely non-functional on hosting platforms like Frappe Cloud without custom Nginx interventions.
Steps to Reproduce
Install POSNext on a standard Frappe environment.
Navigate to /pos.
Attempt to trigger offline mode or use the browser "Install App" button.
Console error shows service worker registration failed/restricted due to scope limits.
Expected Behavior
Please implement one of the following within the app core:
Move sw.js to a path that serves from the site root (e.g., using a Frappe web route or placing it in a www/ folder as sw.js).
Alternatively, force the registration script to use { scope: '/' } and ensure the backend app injects the Service-Worker-Allowed: / HTTP header when serving the file.
Actual Behavior
Please implement one of the following within the app core:
Move sw.js to a path that serves from the site root (e.g., using a Frappe web route or placing it in a www/ folder as sw.js).
Alternatively, force the registration script to use { scope: '/' } and ensure the backend app injects the Service-Worker-Allowed: / HTTP header when serving the file.
Screenshots / Screen Recordings
https://private-user-images.githubusercontent.com/232073080/604979519-13b0a35c-16f1-4e5a-a938-dff9a8749152.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODIzNzg0NjMsIm5iZiI6MTc4MjM3ODE2MywicGF0aCI6Ii8yMzIwNzMwODAvNjA0OTc5NTE5LTEzYjBhMzVjLTE2ZjEtNGU1YS1hOTM4LWRmZjlhODc0OTE1Mi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwNjI1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDYyNVQwOTAyNDNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04ZWY4N2I0NzAxM2I0M2NmNmVjZjgwNmUzYTUyNjhlNDZlYmViNDQzMjAyMTExZTZkMGRjZjk4ZDI2MDcwNjc3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZyZXNwb25zZS1jb250ZW50LXR5cGU9aW1hZ2UlMkZwbmcifQ.zGSmcjQl8-t2AE30QisgjxWmyDXN3ah_pE7jDUcAkFM
Browser Console Errors
POS Next Version
1.13.0 (Latest)
Exact Version (if known)
1.16.0
Frappe Framework Version
15
ERPNext Version
15
Browser
Chrome
Browser Version
149.0.7827.158
Operating System
Windows 11
Deployment Type
Self-hosted (Production)
Bug Frequency
Always (100% reproducible)
Offline Mode
No - Online mode only
Additional Context
No response
Server Logs (if applicable)
Pre-submission Checklist
Issue Search Confirmation
Bug Description
Offline mode and PWA browser installation fail out-of-the-box due to a service worker scope restriction.
Current SW Location: /assets/pos_next/pos/sw.js
POS App Route: /pos
Because the service worker is nested inside the assets directory, browsers restrict its security scope. It cannot intercept network requests or cache assets for the /pos page, rendering offline mode completely non-functional on hosting platforms like Frappe Cloud without custom Nginx interventions.
Steps to Reproduce
Install POSNext on a standard Frappe environment.
Navigate to /pos.
Attempt to trigger offline mode or use the browser "Install App" button.
Console error shows service worker registration failed/restricted due to scope limits.
Expected Behavior
Please implement one of the following within the app core:
Move sw.js to a path that serves from the site root (e.g., using a Frappe web route or placing it in a www/ folder as sw.js).
Alternatively, force the registration script to use { scope: '/' } and ensure the backend app injects the Service-Worker-Allowed: / HTTP header when serving the file.
Actual Behavior
Please implement one of the following within the app core:
Move sw.js to a path that serves from the site root (e.g., using a Frappe web route or placing it in a www/ folder as sw.js).
Alternatively, force the registration script to use { scope: '/' } and ensure the backend app injects the Service-Worker-Allowed: / HTTP header when serving the file.
Screenshots / Screen Recordings
https://private-user-images.githubusercontent.com/232073080/604979519-13b0a35c-16f1-4e5a-a938-dff9a8749152.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODIzNzg0NjMsIm5iZiI6MTc4MjM3ODE2MywicGF0aCI6Ii8yMzIwNzMwODAvNjA0OTc5NTE5LTEzYjBhMzVjLTE2ZjEtNGU1YS1hOTM4LWRmZjlhODc0OTE1Mi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwNjI1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDYyNVQwOTAyNDNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04ZWY4N2I0NzAxM2I0M2NmNmVjZjgwNmUzYTUyNjhlNDZlYmViNDQzMjAyMTExZTZkMGRjZjk4ZDI2MDcwNjc3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZyZXNwb25zZS1jb250ZW50LXR5cGU9aW1hZ2UlMkZwbmcifQ.zGSmcjQl8-t2AE30QisgjxWmyDXN3ah_pE7jDUcAkFM
Browser Console Errors
POS Next Version
1.13.0 (Latest)
Exact Version (if known)
1.16.0
Frappe Framework Version
15
ERPNext Version
15
Browser
Chrome
Browser Version
149.0.7827.158
Operating System
Windows 11
Deployment Type
Self-hosted (Production)
Bug Frequency
Always (100% reproducible)
Offline Mode
No - Online mode only
Additional Context
No response
Server Logs (if applicable)
Pre-submission Checklist