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

Server on http:// returns https:// links #51

Open
alexander-akait opened this issue Feb 1, 2019 · 5 comments
Open

Server on http:// returns https:// links #51

alexander-akait opened this issue Feb 1, 2019 · 5 comments

Comments

@alexander-akait
Copy link

If you have site on https and run php server on http the function get_site_icon_url return a link with https.

I think the problem here https://github.com/WordPress/WordPress/blob/master/wp-includes/general-template.php#L810, because WordPress should use here get_site_url() instead get_option( 'site_icon' ).

Maybe we can add filter on get_site_icon_url to fix it problem or we should fix it in WordPress?

@alexander-akait
Copy link
Author

alexander-akait commented Feb 1, 2019

Same problem for wp_upload_dir so all images have https, maybe we can add more filters here https://github.com/wp-cli/server-command/blob/master/router.php?

@swissspidy
Copy link
Member

Worth noting that get_option( 'site_icon' ) just holds the ID of the site icon, not its URL. The actual URL is generated by wp_get_attachment_image_url() and then wp_get_attachment_url(), which uses the image URL stored in the attachment metadata in the database.

So the right filter in that case would probably be wp_get_attachment_url.

@alexander-akait
Copy link
Author

@swissspidy yep, i find what wp_get_attachment_url use wp_upload_dir for getting host, so i think filter should in wp_upload_dir, it is fix all images urls

@schlessera
Copy link
Member

I'm not sure this can be easily solved. You still have all the links that are stored throughout post content fields that point to https://.

Maybe a better approach would be to add a flag --adapt-scheme that filters the actual output to replace all https:// links pointing to the local server with http:// links?

@schlessera schlessera changed the title get_site_icon_url return link with https Server on http:// return https:// links Feb 4, 2019
@schlessera schlessera changed the title Server on http:// return https:// links Server on http:// returns https:// links Feb 4, 2019
@alexander-akait
Copy link
Author

@schlessera we rewrite url in production, but for development mode will be great have valid url

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

No branches or pull requests

3 participants