CleverTap / clevertap-web-sdk

CleverTap Web SDK
https://clevertap.com/
MIT License
14 stars 18 forks source link

ios proxy setup: proxy domain does not give 200 with no respose body #97

Closed abhushanaj closed 1 year ago

abhushanaj commented 1 year ago

Hi, there Clevertap team.

Due to analytics packet drops on ios devices, we decided to run clever tap by using a custom reverse proxy on our server and followed through the steps mentioned on the docs

Although the proxy setup seems to be running fine, we could see our events get populated, we do not receive any response body when hitting the API through curl or similar, unlike the original domain which returns a response body.

Status code of 200 with empty body. (proxy domain)

https://{proxyDomain}/a?t=96&type=push&d=N4IgLgngDgpiBcIoCcD2AzAlgGzgGiTS1wVAGMwB9VKMVAVzAXQENsBnGAXwMwBMEIAEoBWAJwBaANIB2KRJEAWAGwAtEAQDmg9GICMygBzpdZMnsWKARgAYZVgEx7zZGOjKOxRq8o0h2CAYyNiIyimGGBFDa8A5cQA%3D&optOut=false&rn=1&i=1670574827&sn=0&gc=f9168ff9cc144b07b21c1cefcb2968b6&arp=N4Ig1g%2BgdiBcIG0AEAdEBqAnARkwDgBYBWABgIDZy9M0kAaVEfYsy6tAXRDpACto4IAJoAmAA68ApgHchAQW4gAlgPiiiYAGYBzAIoBhRQBMIAFwDOcEjyMALKzwBucbD36X4wJAF9FSo4IASkSYALQA0gDs4aFEFABaipJmHtYgAE4pLuSRJESRBAV4PErmAPIAqgAycKbpAK6S3kAAAA%3D%3D&tries=1&useIP=true&r=1670574827575

Status code of 200 with body which has a response. (OG API)

https://eu1.clevertap-prod.com/a?t=96&type=push&d=N4IgLgngDgpiBcIoCcD2AzAlgGzgGiTS1wVAGMwB9VKMVAVzAXQENsBnGAXwMwBMEIAEoBWAJwBaANIB2KRJEAWAGwAtEAQDmg9GICMygBzpdZMnsWKARgAYZVgEx7zZGOjKOxRq8o0h2CAYyNiIyimGGBFDa8A5cQA%3D&optOut=false&rn=1&i=1670574827&sn=0&gc=f9168ff9cc144b07b21c1cefcb2968b6&arp=N4Ig1g%2BgdiBcIG0AEAdEBqAnARkwDgBYBWABgIDZy9M0kAaVEfYsy6tAXRDpACto4IAJoAmAA68ApgHchAQW4gAlgPiiiYAGYBzAIoBhRQBMIAFwDOcEjyMALKzwBucbD36X4wJAF9FSo4IASkSYALQA0gDs4aFEFABaipJmHtYgAE4pLuSRJESRBAV4PErmAPIAqgAycKbpAK6S3kAAAA%3D%3D&tries=1&useIP=true&r=1670574827575

Can you help us with what might be causing this/ or do we need additional setup on clkoudfront to get back the origin response body on viewer request? Assuming the incoming body is used by the SDK itself ??

sinhaayush7 commented 1 year ago

Hi @abhu-A-J , the docs that you mentioned are for IOS. It would help us replicating the issue if you can provide us with a sample code. Also can you please elaborate what your'e trying to achieve over here.

abhushanaj commented 1 year ago

Hi @sinhaayush7 I think a part of it is also related to #96 ...

I could see from here and here that for proxy domain to work in accordance to inline scripts I need to change my inline scripts as below?

Also proxy setup should be independent for web and ios? (related to #96)

var clevertap = {event:[], profile:[], account:[], onUserLogin:[], notifications:[], privacy:[], targetDomain: 'PROXY_DOMAIN'};
clevertap.account.push({"id": "${clevertapAccountId}"});
clevertap.privacy.push({optOut: false}); 
clevertap.privacy.push({useIP: true});