hieutq
August 8, 2017, 11:46pm
1
HI everyone,
I am using Ionic 3, and I get a problem with my application, every request have 1 header with content
X-Requested-With: com.app.myappid
So i want remove or disable this property. could you help me or give me 1 solution for this case. help me please
thank so much
let headers = new Headers();
headers.append('Content-Type', 'application/json');
hieutq
August 9, 2017, 9:18am
3
I try, but i get this message:
Refused to set unsafe header.
and, i think this is append header only, not remove, did you try it ago?
I tried it and it should work
import { Http, Headers } from '@angular/http';
constructor(public http: Http}
let headers = new Headers();
headers.append('Content-Type', 'application/json');
this.http.post('address', JSON.stringify(someData), { headers: headers })
.map(res => res.json())
.subscribe(data => {
//something
}, (err) => {
//something
});
hieutq
August 9, 2017, 10:10am
5
FnnHuman:
this.http.post
Thanks, FnnHuman, but now i’m using this.http.get.
I think this problem is happened with this.http.get only.
do you have any solution for this case!
Where are you testing? Browser, emulator, device?
What is your ionic info output?
hieutq
August 12, 2017, 2:27am
8
I using device, and capture request by proxy progam (burpsuite)
and on burpsuite i see one property in headers
X-Requested-With: com.app.myappid
and some Webserver filter this property and block me, i try to remove this property by burpsuite it working, so now, i want to disable this information in headers
hieutq:
X-Requested-With
Find out if the native app or the Angular code is adding the header. (test in browser, see if also present).
See if it is consistent on Android and iOS.
My guess: This is a default feature of the webview and will be not that easy to disable.
hieutq
August 14, 2017, 1:08am
10
Thanks, my app is crawler data app, so, some time, server filter by block all request have this property:(!
Interesting, you are using Ionic as a base for a mobile crawler? Tell me more.
As I wrote, you will have to find out who exactly is adding this header. When you know, you can start searching for a workaround.
hieutq
February 6, 2018, 1:35am
12
Yeah, I used for crawler, server block my app by this field!