NotionCommotion Posted August 5, 2016 Share Posted August 5, 2016 I am building an API which will provide services to a PHP client (PHP is acting as a server to the browser, but acts as a client to the API). One of the functions the API does is create png images. The browser client needs to access these images. I would rather the browser client not directly access the API server, but only access the PHP webserver. I would also rather not require the PHP server to need to store a copy of the png image. Can I somehow proxy the image so that the browser client directly accesses the webserver and can download the image? Quote Link to comment https://forums.phpfreaks.com/topic/301773-proxy-an-image/ Share on other sites More sharing options...
Jacques1 Posted August 5, 2016 Share Posted August 5, 2016 This is a standard reverse proxy setup, and the configuration for your specific webserver should be in the documentation (or on Google). Quote Link to comment https://forums.phpfreaks.com/topic/301773-proxy-an-image/#findComment-1535695 Share on other sites More sharing options...
NotionCommotion Posted August 5, 2016 Author Share Posted August 5, 2016 This is a standard reverse proxy setup, and the configuration for your specific webserver should be in the documentation (or on Google). So, it cannot be done via PHP, but require Apache/nginx/etc configuration? The PHP server script will be ran by others, and I don't wish to complicate there setup. Quote Link to comment https://forums.phpfreaks.com/topic/301773-proxy-an-image/#findComment-1535696 Share on other sites More sharing options...
Jacques1 Posted August 5, 2016 Share Posted August 5, 2016 You can cURL every single picture with PHP if you want to, but this is obviously the worst possible solution in terms of performance and bandwidth. Setting up a reverse proxy is trivial. Before you jump to hacks, simply ask the people who run the server. Quote Link to comment https://forums.phpfreaks.com/topic/301773-proxy-an-image/#findComment-1535697 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.