How to configure for both http and https content

We recently launched our site and configured it for SSL. All non secured requests are automatically redirected to https. We have enabled two settings “Always use HTTPS”, and “Automatic HTTPS Rewrites”.

We now have the need to serve images from a specific URL branch as either http or https, depending on how the request is made. i.e. no redirect. We have disabled the two settings outlined above, yet the URL requests are still redirected to https.

How can we accomplish our requirement? What are we missing?

Did you also enable HSTS? It should be off for your situation.

Can you post one of the URLs that’s redirecting?

HSTS is not enabled. The website is “www.bbjlinen.com”. An example of the image content is: “www.bbjlinen.com/wp-content/uploads/2019/02/Black-Napkin-300x300.jpg”. What is interesting is that even with the two settings disabled, the entire site is still getting redirected to https. Thanks in advance for any insight !!

If your WordPress URL is configured for HTTPS in General Settings, then that might be what’s doing it. And that’s a tough one to work around, as WordPress really wants to correct anything that doesn’t conform to that URL.

I understand that communication between Cloudflare and my origin site may be redirected to https by the WordPress config. However, if the image content is cached by Cloudflare, why is Cloudflare forcing a redirect when no communication with the Origin Sever is needed to answer the end client request?

Can you try doing a “purge everything” in the caching tab? The redirects might be cached.

2 Likes

The image content is cached by a specific URL which includes HTTPS. The HTTP image does not exist, and if you try to get it, Cloudflare has to retrieve it from your website, but your website redirects to HTTPS.