-
Notifications
You must be signed in to change notification settings - Fork 384
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
[amp-autocomplete ] Fix invalid URL protocol for local development #5402
Comments
Is your local development site running under HTTP and not HTTPS? In looking at the AMP playground, you can see that So on one hand, this would ideally be something that AMP core would update in the validator, to exempt Otherwise, to exempt |
The quick fix is to enable HTTPS for your local environment. |
I develop locally using Browsersync – the HTTP version page refreshes faster than HTTPS. |
I suggest you conditionally add the And then also add this plugin code: if ( wp_get_environment_type() === 'local' ) {
add_filter( 'amp_dev_mode_enabled', '__return_true' );
} |
Does adding |
It forces the |
See default value for this filter here: amp-wp/includes/amp-helper-functions.php Lines 1442 to 1462 in 27718b0
|
I think amending the logic as follows would also make sense: --- a/includes/amp-helper-functions.php
+++ b/includes/amp-helper-functions.php
@@ -1458,6 +1458,16 @@ function amp_is_dev_mode() {
( is_admin_bar_showing() && is_user_logged_in() )
||
is_customize_preview()
+ ||
+ (
+ ! is_ssl()
+ &&
+ (
+ ( function_exists( 'wp_get_environment_type' ) && 'local' === wp_get_environment_type() )
+ ||
+ 'localhost' === wp_parse_url( home_url(), PHP_URL_HOST )
+ )
+ )
)
);
} This can then be combined with extending the |
This should also address an issue I've seen with wp-env, where when the PWA plugin is enabled, there are validation error due to the use of |
Bug Description
Invalid URL protocol http: for attribute src
for amp-autocomplete on local development.The plugin triggers
INVALID_URL_PROTOCOL
for//localhost:3000/wp-json/neoblog/v1/search/
URL.Expected Behaviour
It shouldn't be consider an error. To test amp-autocomplete I need to disable the plugin or select View with AMP disabled.
Acceptance criteria
Implementation brief
QA testing instructions
Demo
Changelog entry
The text was updated successfully, but these errors were encountered: