Why does the element display http
Answered
Air Penguin posted this in #help-forum
The next/image assigned src is https, and http is displayed on the element, with no redirection when loaded
50 Replies
@Air Penguin The next/image assigned src is https, and http is displayed on the element, with no redirection when loaded
could you show how you used the
<Image ... /> element?also is this running in prod or is it a dev server?
i suspect next would use to
http instead of https on a dev environment, but that's just a guessI also configured remotePatterns in next.config.js
that's odd, have you tried doing a simple curl on the site and verify that it uses
http from the source?@Air Penguin The next/image assigned src is https, and http is displayed on the element, with no redirection when loaded
from what i could tell in this screenshot, it seemed like chrome is actually sourcing the image from the
have you checked the networks tab to verify that it did use
https url despite the actual src being http; it could be either from chrome doing it by itself, or from an http upgrade from that server's sidehave you checked the networks tab to verify that it did use
https to fetch the image?yeah networks use https to get this image
This is very strange
Using curl at the terminal will display 301, but the browser will not, it will directly load the https image, although the src display http
humm but the issue is that next's image uses
http right?since you supplied an
onLoad parameter to the component, the loadedCb function perhaps did something that makes next's image use http to fetch the imageoh sorry i confused
onLoad as loader 😅indeed
i had just noticed, my prod next site uses a
/_next/image/... as src instead of just the url right away?and it has
srcset onoh did you use the wrong component?
next's image is imported from
next/image, could you make sure of that?@iyxan23 i had just noticed, my prod next site uses a `/_next/image/...` as src instead of just the url right away?
also this page is dynamically-rendered
@iyxan23 i had just noticed, my prod next site uses a `/_next/image/...` as src instead of just the url right away?
i set
unoptimized: true,so instead of using optimized image addresses,oh right
I'm trying to console the data to see if something has changed it, although it might not, right
yeah from what i could read on next's source, the image's src is passed right through without modification at all when
unoptimized is truehttps://github.com/vercel/next.js/blob/canary/packages/next/src/client/legacy/image.tsx#L368-L370 if you're interested lol
fine, I'll check it later.
I would like to add one thing,
My picture is now provided by two services, another service https://ws-cms.justfit.app is no problem
I would like to add one thing,
My picture is now provided by two services, another service https://ws-cms.justfit.app is no problem
that's funny.
im guessing the url you got from
contentItem.image could be httpAnswer
maybe try
contentItem.image.replace("http", "https") just to check lolyeah, really a good way to debug
I found out why ...this has to do with my cms S3 plugins...lol
It was closed. Just turn it on
oh cool 👍
didn't know you were using a CMS
tho it's kinda odd that next's
remoteImages didn't catch the httpmaybe because you enabled the
unoptimized optionyes, I did omit this part of the information, I am very sorry
no prob, as long as it works, it works 

thank you lol
@Air Penguin thank you lol
Dont forget to mark an answer so the thread gets closed out 🙂
I tried it. How do I label the answer

right click > apps > mark solution
“Thank you lol” is not the answer