Stop google's proxy stripping custom headers - android

Just launched a new AngluarJs mobile site that passed developer and QA testing and now live a small percentage of users are getting errors(could not find expected value).
Tracked this down to Android Chrome users that have the "Reduce Data Usage" setting toggled ON which then routes requests through Google's data compression proxy.
The reason this is generating an error is that the server does not receive the custom http header that is passed from the client. We can clearly see that the Google proxy is stripping it.
How can we stop Google's proxy stripping custom headers and is this expected behaviour? I could not find anything related in the developer Docs.

Google's Compression Proxy doesn't strip response headers, at least those beginning with X-. See below the response headers of this web page using Compression Proxy:
cache-control: public, max-age=60
content-encoding: gzip
content-length: 15283
content-type: text/html; charset=utf-8
date: Sat, 31 Jan 2015 20:17:30 GMT
expires: Sat, 31 Jan 2015 20:18:30 GMT
last-modified: Sat, 31 Jan 2015 20:17:30 GMT
server: GFE/2.0
status: 200 OK
vary: *
version: HTTP/1.1
via: 1.1 Chrome-Compression-Proxy
x-frame-options: SAMEORIGIN
x-original-content-length: 15283
x-request-guid: 719ab2fb-7f3b-4296-b6fd-497997ffe761
So the possible solution is to use X-SiteHost header name.

Related

UIWebView clears cache After Application Exit & Not caching images offline

HTTP Response Header
Name Value Delim
Status: HTTP/1.1 200 OK
Server: Apache
Content-Type: image/jpeg
Accept-Ranges: bytes
Last-Modified: Wed, 16 Oct 2013 12:06:35 GMT
Content-Length: 54556
Cache-Control: max-age=604800
Expires: Thu, 24 Oct 2013 09:32:54 GMT
Date: Thu, 17 Oct 2013 09:32:54 GMT
Connection: close
When I run the application Once everything runs Fine and Yes images are cached for Application Life Time, But when I close application and Run again with WIFI off. Image do Not appear. its working FINE in android and but is not working in iOS application. All headers seem valid.
The images have 7 days expiry. iOS should cache it for 7 days.
http://cdn.koimoi.com/wp-content/new-galleries/2013/10/Tanisha-Mukherjeen-in-Bigg-Boss-7-Pic-1.jpg
http://web-sniffer.net/
OLD QUERY For Search Optimization: iOs Phonegap application ignoring cache Headers and Not caching images
We were also able to do the Offline caching via RNCachingURLProtocol Library. Please see online for the library...only drawback is it does not clear the cache. need to verify that...

How to make sure if a download is resumable

I am creating a downloadaccelerator library
Is there any way to know before starting a download from a link weather the server supports resuming downloads/downloading file reange . Because if it does then i ll use multipple connections and download ranges or else i ll download the whole file normally
thank you
Similar to GET header to get the required html page, we have something called as HEAD header.
When you send a HEAD request for an URL we get a set of values for the URL
Example: if you want to know details of
http://www.wgz.org/chromatic/perl/IntroTestMore.pdf
Send a HEAD command to the URL, the response will be
Date: Mon, 03 Nov 2008 06:29:09 GMT
Accept-Ranges: bytes
ETag: "156046f-11889-3a578cd2bf2c0"
Server: Apache
Content-Length: 71817
Content-Type: application/pdf
Last-Modified: Thu, 11 Jul 2002 04:53:07 GMT
Client-Date: Mon, 03 Nov 2008 06:29:10 GMT
Client-Peer: 167.168.132.148:8080
Client-Response-Num: 1
Intresting Values: Accept-Ranges, Content-Length
Accept-Ranges: bytes tells that server is ready to give files part by part as requested
More info here: http://www.crazyengineers.com/community/threads/how-does-resume-download-work.7396/

Android C2DM 200 Error

I'm trying to develop a android app that using push notifications. While using the Tomcat Server I'm able to successfully register and push notification to a device. I get the response back as:
HTTP/1.1 200 OK [Connection: Keep-Alive, Transfer-Encoding: chunked, Content-Type: text/plain, Cache-control: no-cache, no-store, Pragma: no-cache, Expires: Mon, 01-Jan-1990 00:00:00 GMT, Date: Wed, 11 Apr 2012 17:25:31 GMT, X-Content-Type-Options: nosniff, X-XSS-Protection: 1; mode=block, Server: GSE]
But when trying to implement the same code using WebSphere, I encounter the following error for registration:
Exception :Exception in executing http post request for Android Registration: HTTP/1.1 200 Error
Can anyone point out on what I may be missing between these two different environments?
I would start by using curl and/or network monitoring/logging to lay out exactly what request is being sent to the C2DM servers.
It certainly seems odd WebSphere is receiving a 200, but showing it as an error. That's where I'd be looking.

android twitter4j oauth does not works when on 3g

I've created an android app using twitter4j.
None of the api calls can authenticate when on 3g, but work perfectly when on wi-fi.
What could be the problem?
I've tested this extensively and can confirm this is only a problem on Android 4.0 (ICS) devices. Why, I'm unsure yet, though some parts of HttpURLConnection have changed in 4.0, so some of these changes have made twitter4j incompatible.
I thought it may have been this:
Android 4.0 ICS turning HttpURLConnection GET requests into POST requests
but after analysing the requests with tcpdump it seems like it is in fact making a valid GET, but for some reason, the twitter api still says it's a bad request..
GET /1/users/show.json?include_entities=true&user_id=6842472 HTTP/1.1
Authorization: OAuth oauth_consumer_key="<redacted>",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1331150787",oauth_nonce="2157367237",oauth_version="1.0",oauth_token="<redacted>",oauth_signature="<redacted>"
Accept-Encoding: gzip
X-Twitter-Client-URL: http://twitter4j.org/en/twitter4j-2.2.5.xml
User-Agent: twitter4j http://twitter4j.org/ /2.2.5
X-Twitter-Client-Version: 2.2.5
X-Twitter-Client: Twitter4J
Host: api.twitter.com
Connection: Keep-Alive
HTTP/1.1 400 Bad Request
Date: Wed, 07 Mar 2012 20:06:30 GMT
Status: 400 Bad Request
X-RateLimit-Class: api
X-RateLimit-Reset: 1331153824
X-Revision: DEV
Last-Modified: Wed, 07 Mar 2012 20:06:30 GMT
X-Frame-Options: SAMEORIGIN
X-Transaction: a0bf805e990a5c79
Content-Type: application/json; charset=utf-8
X-RateLimit-Remaining: 0
X-RateLimit-Limit: 150
Pragma: no-cache
Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
X-Runtime: 0.00742
X-MID: 2295d07237fcb4763f7f54d2bf46e27dd40e022f
Expires: Tue, 31 Mar 1981 05:00:00 GMT
Vary: Accept-Encoding
Server: tfe
Transfer-Encoding: chunked
Connection: close
Content-Encoding: gzip
Set-Cookie:
...
Unless someone can find what it is in ICS/HttpURLConnection that is breaking this the only workaround I can see is to write an alternate backend for twitter4j that uses HttpClient instead of HttpURLConnection, which is exactly what I plan to do.
EDIT: So I wrote the a client backend for twitter4j that uses the apache httpclient and it suffers from the exact same problem!! Some more sleepless hours and wireshark has brought me to the following very handy solution, that actually works:
Initialise your twitter4j instance like this:
ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
configurationBuilder.setOAuthConsumerKey(Const.CONSUMER_KEY);
configurationBuilder.setOAuthConsumerSecret(Const.CONSUMER_SECRET);
configurationBuilder.setUseSSL(true);
Configuration configuration = configurationBuilder.build();
twitter = new TwitterFactory(configuration).getInstance();
The setUseSSL(true) is the magic line.

H264 apparently doesn't work on Android browser

At the beginning of a project with mobile videos, I tested h264 in an html5 player (video-js), and sent it to a friend to get it tested. It was working well un google browser for android.
I am now at the end of the project, and have sent the link to other people, just to be sure it really work.
Unfortunately, it doesn't seem to be working...
If you have an android mobile phone, could you test it in the google browser?
http://daviddarx.com/stuffs/work/mjf_video_exemples/index.html (the video of the bottom is the html one)
H264 should work on both IOS and android browsers, isn't it?
If else, could you give me more correct indications about formats for these both platforms?
Thank you in advance!
David
Please fix your content type header:
huiske-imac:tmp moo$ wget -S http://daviddarx.com/stuffs/work/videos/mjf_1500.mp4
--2011-09-20 16:21:54-- http://daviddarx.com/stuffs/work/videos/mjf_1500.mp4
Resolving daviddarx.com (daviddarx.com)... 80.74.154.187
Connecting to daviddarx.com (daviddarx.com)|80.74.154.187|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Date: Tue, 20 Sep 2011 13:21:54 GMT
Server: Apache/2.0.52 (CentOS)
Last-Modified: Mon, 08 Aug 2011 11:10:35 GMT
ETag: "17440f9-231e307-7f0920c0"
Accept-Ranges: bytes
Content-Length: 36823815
Keep-Alive: timeout=2, max=10
Connection: Keep-Alive
Content-Type: text/plain
Length: 36823815 (35M) [text/plain]
Saving to: `mjf_1500.mp4'

Categories

Resources