After replacing the certificate, the page style is missing half, how to clear the http external links in the https page?
After replacing the certificate, the page style and images are missing half, how should the remaining http resources in the https page be cleaned up? First, differentiate between those blocked and automatically rewritten: styles and scripts will be blocked directly by the browser, while images and audio-visuals will be automatically upgraded to encrypted addresses.The specification document makes it very clear regarding this default behavior—the browser will automatically upgrade mixed content requests for image, video, and audio from HTTP to HTTPS, and intercept all other types of insecure requests, including style sheets, scripts, embedded frames, fonts, and addresses used in CSS.So a scene like 'Half of the style is missing' can be immediately located to the residual reference.
What did the browser do when the style was missing half?
The browser did not report an error when rendering, it did was 'refuse to retrieve'. The page itself loaded normally, and unsafe requests such as styles and scripts were discarded, so the page became a bare structure with some content.
It looks like the certificate is installed incorrectly, but actually, the address has not been changed cleanly. There are three identifying points for this kind of scene: there are mixed content related prompts in the console; discarded requests point to plaintext addresses; only some resources are missing, rather than the entire page not opening.
Missing image situations are more麻烦. It belongs to the 'can be automatically upgraded' type, and the browser will try to change to an encrypted address to retrieve it - if the source site does not have an encrypted port, the image really cannot be retrieved. Therefore, 'missing images' often means that the source site does not support encrypted access, not that there is a mistake in the page.
The difference between blocked and automatically upgraded resource types
The consequences of two different links are also different, and the handling methods are also different.
The types of blocked (stylesheets, scripts, embedded frames, fonts, requests initiated by scripts) result in direct loss of functionality and appearance, with obvious holes on the page; even if the source site supports encrypted access, the browser will not change the address for you.
The types of automatically upgraded (images, audio, video, background images and border images in CSS) depend on whether the source site supports encrypted access: if it supports it, it will be displayed normally, and if it does not support it, it will be blank.
This difference determines the priority of cleaning: first clear the batch that was blocked, and the page appearance will recover immediately; then clear the batch that was upgraded, considering 'whether the source site supports it' as a condition to check together.
There is a category of exceptions that need to be recorded separately: resources specified through the multiple address attributes of images or responsive image tags belong to the range that can be blocked, and are not on the automatic upgrade list. This kind of location is most prone to being overlooked.
The three-step order of cleaning within the site
The first step is to locate residues. The scope should cover three areas: absolute addresses written into the text data, template and static resource references, and site addresses and external links in configuration items. Searching only for templates is the most common oversight, as historical content in the text is the main source.
The second step is to batch replace. AnQiCMS provides a full-site replacement tool that can batch replace keywords or links, making it more controllable to process text data than to make manual changes article by article. Three disciplines: first limit the replacement scope (only in the text and attachment path section), first try it out in one or two columns, and keep a backup before replacement to facilitate rollback.
The simplest way to change to an internal relative address, and replace the ones that cannot be changed with encrypted addresses. The site address in the configuration items should be checked separately, as it affects the generation of absolute addresses, sitemap, and address form when pushing.
The third step is to close the jump. Since the certificate has been installed, plain text addresses should be unified to point to encrypted addresses. AnQiCMS supports 301 jump management and redirection settings, matching the plain text entry to the encrypted target, and processing the column path with the old address at the same time. The jump rules should be changed at the same time as the replacement, and only changing the content but not the jump will leave two sets of addresses coexisting.
What checks are left after the modification
Do the four items in order:
Open typical pages (home page, list, detail, form page, background login) with the browser, check if there are any remaining prompts in the console; focus on the missing styles, as these are usually historical texts.
Check the property writing of referenced resources, especially for multi-address properties and responsive image tags, which are not within the scope of automatic upgrades.
Check third-party embedded positions. The addresses of embedded frames and external scripts are provided by the other party, and they cannot be modified by the on-site replacement tool; such addresses can only be confirmed one by one whether they support encrypted access, and if not, consider removing them.
Check the address form in the site map and push, make sure to submit the encrypted final address, to avoid the appearance of old and new sets in the index.
Common questions
Add a response header to upgrade all insecure requests, can it replace cleaning?It can be used as a transition. The upgrade instructions in the content security policy will change all requests to encrypted addresses, including interceptable types, but it changes the retrieval method, not the data itself; the residual addresses are still there, and they will reappear in the future when the environment changes. Use it during the transition period, but cleaning still needs to be done.
The image address of the historical articles in the main text is very long, do I have to change all of them manually?Not necessary. Types that are automatically upgraded will not cause style loss and can be placed in the next batch; style, script, and font should be handled first.
Will the index be affected after the change?It won't be handled properly, provided that plain text addresses are redirected to encrypted addresses, and the two sets of addresses should not be accessible at the same time. The address form submitted to the search side within the site should be updated together.
How to avoid missing again next time?Write the site address as a configuration item instead of scattering it everywhere; try to use relative addresses for references to templates and text; when adding new external links, filter them according to whether they support encrypted access.