I am sending a buffer from my browser to my CI server app. The problem is that is_ajax_request() takes a look at
HTTP_X_REQUESTED_WITH server header and it seems this is not being set so "is_ajax_request()" is failing.
Taking a look at the browser debugger here are the request headers
Code:
Provisional headers are shown
Access-Control-Request-Headers: x-requested-with
Access-Control-Request-Method: POST
Origin: chrome-extension://bdjgnodlhfmhghjhbkkkaaammfocdpib
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
So I am sending it, but it seems to not be in $_SERVER[]. Instead in $_SERVER[] I see:
Code:
HTTP_HOST = {@140470162541456} "www.xxxubstantiation.com"
HTTP_CONNECTION = {@140470162541824} "keep-alive"
HTTP_PRAGMA = {@140470162542192} "no-cache"
HTTP_CACHE_CONTROL = {@140470162542568} "no-cache"
HTTP_ACCESS_CONTROL_REQUEST_METHOD = {@140470162542968} "POST"
HTTP_ORIGIN = {@140470162543440} "chrome-extension://bdjgnodlhfmhghjhbkkkaaammfocdpib"
HTTP_USER_AGENT = {@140470162544288} "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
HTTP_ACCESS_CONTROL_REQUEST_HEADERS = {@140470162544696} "x-requested-with" <<<<<here
HTTP_ACCEPT = {@140470162545088} "*/*"
HTTP_ACCEPT_ENCODING = {@140470162546008} "gzip, deflate, br"
HTTP_ACCEPT_LANGUAGE = {@140470162546392} "en-US,en;q=0.9"
I thought that I would see a 'HTTP_X_REQUESTED_WITH'="x-requested-with".
Another possible reason that this is not working is that there is some rule against using redirect with CORS. As you can see below, there is some redirection going on. I don't know where that is being set.
Code:
REDIRECT_SCRIPT_URL = {@140470162537752} "/sub_crud/Subit_backend/register"
REDIRECT_SCRIPT_URI = {@140470162538248} "https://www.xxxubstantiation.com/sub_crud/Subit_backend/register"
REDIRECT_HTTPS = {@140470162538624} "on"
REDIRECT_SSL_TLS_SNI = {@140470162539032} "www.xxxubstantiation.com"
REDIRECT_STATUS = {@140470162539408} "200"
Does anyone know how the $_STATUS elements get set?
proof that an old dog can learn new tricks