PHP proxy for videos - not working on some Apple devices - php

The problem i'm facing is this:
I have a video on remote server that is loaded on my website
some users cannot access video because remote server URL is blocked
I create a proxy in PHP that is loading data from remote server with file_get_contents(), I'm getting headers from remote server and returning for the user response with same headers and content as a remote server.
Everything is working well on all devices except some Apple devices. It shows empty player with message Failed to Load Resource, Plugin Handled Load.
I spend a lot of time on looking for solution, was trying to handle even HTTP range requests with no success. I mange to reproduce error with postman using Safari headers and I manage to handle HTTP range request and video was working on Postman, but not in Safari. The only thing that may solve the issue is downloading file to my server and use the path to file to let nginx serve the file, but it means that I should have some cronjob that will remove file after usage.
So I hope that someone can give me ideas how to "fake" nginx response using PHP, just using headers and regular or streamed response is not enough.

Related

Microsoft Translator API Doesn't Work Cross-server

does this API just not work via cross origin resource? My CORS headers are set in .htaccess and verified working, because I do get a response from the API, but it's an unknown error.
I set everything up and tested on a single test server and it all works. But my prod environment requires two separate domains, one which is a CMS where the pages are hosted, and then a separate PHP server where I'm hosting the PHP side of the app that makes the CURL requests. When I try to make a CORS request, I get
{"error":{"code":500000,"message":"An unexpected error occurred. If the error persists, report it with date/time of error, request identifier from response header X-RequestId, and client identifier from request header X-ClientTraceId."}}
I get the same thing when I mimic a CORS scenario locally by using a XAMPP PHP server and a Gulp HTTP server.
My setup currently builds the JSON from body copy on a page, then sends that via AJAX POST to the PHP file, which then processes it, encodes, makes Curl requests to the API, then outputs the response. I then handle the data from the response again in the JS file.

Videos not playing due to no Access Control Allow Origin

I am working on a web project, I just started using a JavaScript based video player in Wordpress. The video player works fine when using videos on the same server but when requesting videos from other servers it throws the error in browser console:
Failed to load http://techslides.com/demos/sample-videos/small.mp4: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.gozo.kitchen' is therefore not allowed access
I am trying to access the video on a different server.
I have tried locating the server configuration file but I cannot find it here's a summary of what I have done till now :
Server is running the linux operating system. I can find the nginx.config but its empty and enabling it to use CORS does not seem to solve the problem. The video still does not run.
There is no config file under the etc directory.
I need to enable CORS to access videos on other servers.
You're requesting a resource from another server so the other server must allow you to retrieve it with an Access-Control-Allow-Origin header that matches your site details. You can disable this when you start chrome with the --disable-web-security flag but that should only be used for testing.

authorize.net response_url https/http issue

Authorize.net consumes my response_url, which is on HTTP, into their HTTPS hosted dll. How can I specify that their dll should be on HTTP, so that my CSS and JS files get pulled in correctly?
I don't have a way of getting access to an SSL host at the moment.
Edit: First, we send from HTTP to their HTTPS hosted form. On their server. Then, their server consumes our HTTP page and dispalys it in their HTTPS response dll.
I only want their response_dll to be on HTTP. I don't see a security issue with that, and imagine there is a way to do this, as their service offering is meant for people without SSL enabled.
Edit2: I'm using their Simple Checkout API.
Answering my own question, based on some advice to contact tech support directly. I did, and their response was:
"We can only relay the html content. We do not offer to relay other content such as images. It is necessary that any images you want to include are hosted using https."
Edit --
I attempted to include a single logo image as a base64 string inside a static html page. That failed with a "script timeout". I speculate this is due to the size of the html file after using that string.
This is a total failure on the part of Authorize.Net

PHP Proxy: Pass Thru HTTP Response Headers from HLS Streaming Server

I'm trying to proxy calls to an HTTP Live Streaming Server (lighttpd) through a PHP proxy. However, it does not appear that the headers being returned from the streaming server are being passed back to the client. Because of this, the video content isn't actually being streamed back to the client when going through my proxy (it's as if the client is still waiting for the entire file to be sent).
Anyone have any ideas on how to do this? Are there any open source PHP Proxies that can handle proxying streaming content?
Thanks!

The response of a server receiving a file is automatic or must be manually coded?

I am developing an iPhone application that sends through HTTP requests an XML file to my PHP server.
I have coded my server and got the XML file and stored it in database. Now I want to see from my iPhone if the server got my XML file.
This response of the server, I must code it or is it automatic?
If it is not automatic, how do I make it? I must make the server send back a simple XML to my iPhone stating that everything is "OK" and also program my iPhone application to get the XML?
Assuming you have set up some proper API for your App to query, just use HTTP Status Codes. If everything was ok and the data got successfully inserted, reply with a 200 response. If there was an error there are numerous other status codes to send, e.g. 500 internal server error. Your client App can then parse these responses and react appropietly.

Categories