Skip to content
Advertisement

Proxy pass image Laravel

I’m trying to Proxy serve an HTTP image in my HTTPS site I heard that I can do a proxy serve of this file in one of my endpoint and render it in my site instead of displaying the actual file url. Below Is what I did but I’m getting the error below enter image description here

Below is my HTML code I created my Custom Facade to display the image

JavaScript

Below is my code in Laravel PHP

JavaScript

Any idea on how to achieve this? I just want to display the image

Advertisement

Answer

Ok here is the final answer to my question and thanks to @Lawrence for the idea. Hope this will help others having the same problem

JavaScript

And in my facade below are the code

JavaScript

Now on my blade template I just call the generateUrl. If the image is not in https format then it will return a url with encrypted token appended on it and a parameter of $image just to check if the token and the image in the params are the same url. In my blade I’m doing something like this

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement