Skip to content

Getting CORS Error for Image in PWA

I am facing a CORS issue while fetching image in PWA Studio..Image works fine in magento root but while fetching with same URL in pwa it is giving cors error in console..

The Code of the page is below:

export default function BlogDetail() {
    const { id } = useParams();
    const { fetched } = UseBlogdetails(id);
    return (
                   ..........
                    <img src={`http://127.0.0.1/training/magento246/pub/media/blog/img/${fetched?.image}`} />
               ..........

Below is the path of image made in developer tools..It is Perfect..

enter image description here

and getting error as below:

enter image description here