Skip to content
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

Setup for valet site or without php artisan server #2

Open
DesarrollouCR opened this issue Oct 12, 2024 · 2 comments
Open

Setup for valet site or without php artisan server #2

DesarrollouCR opened this issue Oct 12, 2024 · 2 comments

Comments

@DesarrollouCR
Copy link

DesarrollouCR commented Oct 12, 2024

Hello,

First thanks for a good solution... but we wants to use the above for valet site or we want's to use this for our hosted webiste on cPanel... we removing /public path and running that directly from the public folder... so it is always giving us error

The path of the provided scope ('/') is not under the max scope allowed ('/build/'). Adjust the scope, move the Service Worker script, or use the Service-Worker-Allowed HTTP header to allow the scope.

Any suggestion.

@DesarrollouCR DesarrollouCR closed this as not planned Won't fix, can't repro, duplicate, stale Oct 12, 2024
@DesarrollouCR DesarrollouCR reopened this Oct 12, 2024
@sfreytag
Copy link
Owner

sfreytag commented Oct 12, 2024

I think your problem is common to everyone using Laravel, no matter the deployment. My fix is to use the Service-Worker-Allowed header as per here for local development: https://github.com/sfreytag/laravel-vite-pwa/blob/main/server.php

For production I added it to the nginx config:

location /build/sw.js {
    add_header Service-Worker-Allowed "/";
}

In cPanel I guess you'd do something similar for Apache with .htaccess?

@DesarrollouCR
Copy link
Author

First Thanks for your fast reply...

Service worker is not installed on production...

But it is working when I run using php php artisan serve

Screenshot-2024-10-12-at-7-12-25-PM-10-12-2024_07_13_PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants