-
Notifications
You must be signed in to change notification settings - Fork 274
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
Move URL rewriting from the service worker to the request handler #1054
Comments
Makes sense to me. We should rewrite all requests the same way htaccess does it. |
I wouldn't replace |
@bgrgicak I wouldn't add WordPress-specific logic to any |
Surfacing this comment from a related PR: My follow-up question would be: do we still need this code? wordpress-playground/packages/playground/remote/service-worker.ts Lines 51 to 64 in 454fec3
If yes, then #1054 is still relevant and we'll still need to support that logic at the request handler level, otherwise the service worker will rewrite multisite URLs correctly, but other PHP.wasm consumers like WP-NOW and VS Code won't. If not, then #1054 is indeed solved. |
Requests resolved directly via the JS API (
playground.request()
) return error 404 if URL rewriting is required to resolve them. For example,playground.request({ url: '/glotpress/projects });
wouldn't get resolved as/index.php/glotpress/projects
. This is because Playground simulates the required.htaccess
rules in the service worker:wordpress-playground/packages/playground/remote/service-worker.ts
Lines 51 to 64 in 454fec3
And only
fetch()
requests are affected. Instead, Playground should apply the following .htaccess rules in the request handler:Since
PHPRequestHandler
is generic and specific to@php-wasm
, Playground should provide its own WordPress-specific handler, perhaps via the@wp-playground/wordpress
package?cc @akirk @bgrgicak
The text was updated successfully, but these errors were encountered: