Spring RestTemplate forming Invalid Header - tcpdump

In my application for REST call following code is there:
ResponseEntity< String > entity = restTemplate.exchange( uri,
method, httpEntity, String.class );
The uri is proper, method is HttpMethod.GET, httpEntity is null.
On taking TCP Dump following info I got:
E..E.%#...Pc
.A.
.A|...Pt|YX...u.....a.....
c+.t$Je.GET /{uri} HTTP/1.1
05:57:34.986440 IP (tos 0x0, ttl 255, id 37158, offset 0, flags [DF], proto TCP (6), length 8244)
{hostname} > {targetIp}: Flags [P.], seq 274:8466, ack 1, win 211, options [nop,nop,TS val 1663813748 ecr 608855467], length 8192
E. 4.&#...1s
.A.
.A|...Pt|Zi...u.....P.....
c+.t$Je.Accept: text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, te
05:57:34.986451 IP (tos 0x0, ttl 255, id 37159, offset 0, flags [DF], proto TCP (6), length 658)
It seems the text/plain is getting appending after sometime and grows from single occurrence to multiple times till Accept: header length limits
Jar: spring-web-4.3.2.RELEASE.jar
I am getting 400 status on this. Any help would be appreciated.

got the solution for my problem. It was something similar to
Spring Boot singleton RestTemplate Accept Header keeps being appended to
At some other place following code was there
restTemplate.getMessageConverters().add(0, new StringHttpMessageConverter(Charset.forName("UTF-8")));
where restTemplate was autowired and thus header was getting corrupted.

Related

Iam uanble to to Post my "authetincate api" while using PostMan i get a 401 error, saying Unauthorized

Request received for POST '/authenticate':
org.apache.catalina.connector.RequestFacade#f12c208
servletPath:/authenticate
pathInfo:null
headers:
content-type: application/json
user-agent: PostmanRuntime/7.29.2
accept: /
postman-token: 58d8bba7-bea6-4954-b757-f896b74a565e
host: localhost:8080
accept-encoding: gzip, deflate, br
connection: keep-alive
content-length: 56
Security filter chain: [
DisableEncodeUrlFilter
WebAsyncManagerIntegrationFilter
SecurityContextHolderFilter
HeaderWriterFilter
CorsFilter
LogoutFilter
JwtRequestFilter
RequestCacheAwareFilter
SecurityContextHolderAwareRequestFilter
AnonymousAuthenticationFilter
SessionManagementFilter
ExceptionTranslationFilter
AuthorizationFilter
]
2023-02-11T14:54:58.108-05:00 INFO 97832 --- [nio-8080-exec-2] Spring Security Debugger :
Request received for POST '/error':
org.apache.catalina.core.ApplicationHttpRequest#12f51104
servletPath:/error
pathInfo:null
headers:
content-type: application/json
user-agent: PostmanRuntime/7.29.2
accept: /
postman-token: 58d8bba7-bea6-4954-b757-f896b74a565e
host: localhost:8080
accept-encoding: gzip, deflate, br
connection: keep-alive
content-length: 56
Security filter chain: [
DisableEncodeUrlFilter
WebAsyncManagerIntegrationFilter
SecurityContextHolderFilter
HeaderWriterFilter
CorsFilter
LogoutFilter
JwtRequestFilter
RequestCacheAwareFilter
SecurityContextHolderAwareRequestFilter
AnonymousAuthenticationFilter
SessionManagementFilter
ExceptionTranslationFilter
AuthorizationFilter
]
I was expecting to a "200" with user details together with the Jwt Tokenenter image description here

How to pass Request Headers into requests.get(url, headers = headers) in proper format?

Below are the request headers I copied from chrome. How do I pass these values to response = requests.get(url, headers = headers) so that I don't get any error. Should all the keys and values be made strings by enclosing within '' ?
:authority: portal.grab.com
:method: POST
:path: /foodweb/v2/search
:scheme: https
accept: application/json, text/plain, /
accept-encoding: gzip, deflate, br
accept-language: en
content-length: 87
content-type: application/json;charset=UTF-8
origin: https://food.grab.com
referer: https://food.grab.com/
sec-ch-ua: "Google Chrome";v="95", "Chromium";v="95", ";Not A Brand";v="99"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "macOS"
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: same-site
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36
x-country-code: PH
x-gfc-country: PH
x-grab-web-app-version: ~k5VPZk5KBtLKJOP7fLbR
x-recaptcha-token: 03AGdBq24a8dFVYhN75ZFSZR6MSzf8anLJEc-c6xCFkUYi87f5FQLlYV8NeHspOYwqJYS1ypTDvpPVU4FG6NbvkwbwHgHCxAOaiHi8sLtnraXL78xszl-HgySw_yBGCadmL4I9TmnDL8HITA4ug4FZ-tITOWIE9AI1L2OWAgFJC25r663aHtF16pJGLJovE4D1IVm2NziSUhWNdlv9aSxym4s1dGhM9YTu0w2FNCfiHqLURKs-sk4GLQ-O1Xv2xuTRuvBiDxXZYisKKt0nnoMpov5CPmwzFVaQGFXVk5xLz05bsbsdN7gf4DcoGD8i1yM3vbNMld-gqgDJ6DhLX3IY6NxJ_2QdH-dQctu4OCB9oPUursOAFs6ph8Xqf_kL3XQLzdO2qRMhU9wVlmAocV8lm8DTF0Urxp1JkRY6X7SeKDeQsX0KX2vO3ZFFjfYb19Gqpts5CQCGJO5j
There is an example how to format headers in Python requests documentation: Custom Headers so in your case it should looks like this:
headers = {
'accept': 'application/json, text/plain, /',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'en',
'content-length': '87',
'content-type': 'application/json;charset=UTF-8',
'origin': 'https://food.grab.com',
'referer': 'https://food.grab.com/',
'sec-ch-ua': '"Google Chrome";v="95", "Chromium";v="95", ";Not A Brand";v="99"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"macOS"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-site',
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36',
'x-country-code': 'PH',
'x-gfc-country': 'PH',
'x-grab-web-app-version': '~k5VPZk5KBtLKJOP7fLbR',
'x-recaptcha-token': '03AGdBq24a8dFVYhN75ZFSZR6MSzf8anLJEc-c6xCFkUYi87f5FQLlYV8NeHspOYwqJYS1ypTDvpPVU4FG6NbvkwbwHgHCxAOaiHi8sLtnraXL78xszl-HgySw_yBGCadmL4I9TmnDL8HITA4ug4FZ-tITOWIE9AI1L2OWAgFJC25r663aHtF16pJGLJovE4D1IVm2NziSUhWNdlv9aSxym4s1dGhM9YTu0w2FNCfiHqLURKs-sk4GLQ-O1Xv2xuTRuvBiDxXZYisKKt0nnoMpov5CPmwzFVaQGFXVk5xLz05bsbsdN7gf4DcoGD8i1yM3vbNMld-gqgDJ6DhLX3IY6NxJ_2QdH-dQctu4OCB9oPUursOAFs6ph8Xqf_kL3XQLzdO2qRMhU9wVlmAocV8lm8DTF0Urxp1JkRY6X7SeKDeQsX0KX2vO3ZFFjfYb19Gqpts5CQCGJO5j'
}

Receive Json sent from Angular to Laravel

I'm trying to send a json to the backend, here is the piece of code that I use to send data:
register(user): Observable<any>{
let json = JSON.stringify(user);
let params = 'json='+json;
let headers = new HttpHeaders().set('Content-Type', 'aplication/x-www-form-urlencoded');
console.log(json);
console.log(params);
console.log(headers);
return this._http.post('http://api-rest-laravel.com.devel/api/register', params, {headers: headers});
}
This is the code in the backend:
public function register(Request $request) {
Log::info("Datos: " . $request);
$json = $request->input('json', null);
$params = json_decode($json);
$params_array = json_decode($json, true); //Array
Log::info("Json: " . $json);
if (!empty($params) && !empty($params_array)) {
//register
}else{
//send error msg
}
If i try the backend using Postman, this is what i get from Request param:
[2020-10-04 15:37:36] local.INFO: Datos: POST /api/register HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 229
Content-Type: application/x-www-form-urlencoded
Cookie: laravel_session=eyJpdiI6InoxMG53RXZTTGZaV0h3dFF6VmVDUXc9PSIsInZhbHVlIjoiZ2V6ZEFYNjZKOSt0K0RPMmgra0FCMVUwMkhIb0JGSjJ6cW53VkhKSnUwV1ViWENVZTNDaXl3UzlBckZVYXRCSSIsIm1hYyI6ImM2YzA0MjEzYzRjMTEzNmQxYmY4NTJmNDRhNzk1ZGJmZGQwOGU2NmQ2NDM5OWM2MDcwNjFjNmJiMTIzNDIyM2MifQ%3D%3D
Host: api-rest-laravel.com.devel
Postman-Token: 47cfbc5a-136c-424d-9e1b-f61c18c2fc5c
User-Agent: PostmanRuntime/7.26.5
Cookie: laravel_session=pi7VHwGsyzTB36rK7KdbtAUU4GGagUNSklMQliqL
json=%7B%22id%22%3A1%2C%22name%22%3A%22qwer%22%2C%22surname%22%3A%22qwe%22%2C%22role%22%3A%22ROLE_USER%22%2C%22email%22%3A%22qqwer22%40asd.com%22%2C%22password%22%3A%22qqq%22%2C%22description%22%3A%22%22%2C%22image%22%3A%22%22%7D
[2020-10-04 15:37:36] local.INFO: Json: {"id":1,"name":"qwer","surname":"qwe","role":"ROLE_USER","email":"qqwer22#asd.com","password":"qqq","description":"","image":""}
[2020-10-04 15:37:36] local.INFO: goes toIF
and this is request param if I try it in browser ($json is empty, second last line):
[2020-10-04 15:40:30] local.INFO: Datos: POST /api/register HTTP/1.1
Accept: application/json, text/plain, */*
Accept-Encoding: gzip, deflate
Accept-Language: es-ES,es;q=0.9,en;q=0.8
Connection: keep-alive
Content-Length: 127
Content-Type: aplication/x-www-form-urlencoded
Dnt: 1
Host: api-rest-laravel.com.devel
Origin: http://localhost:4200
Referer: http://localhost:4200/
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
json={"id":1,"name":"qwe","surname":"qwe","role":"ROLE_USER","email":"qqwe#asd.com","password":"q","description":"","image":""}
[2020-10-04 15:40:30] local.INFO: Json:
[2020-10-04 15:40:30] local.INFO: goes to ELSE
I also tried to send from frontend a json simillar to the one sent from postman to see if that was the problem. Didn't work.
//return this._http.post('http://api-rest-laravel.com.devel/api/register', 'json=%7B%22id%22%3A1%2C%22name%22%3A%22qwer%22%2C%22surname%22%3A%22qwe%22%2C%22role%22%3A%22ROLE_USER%22%2C%22email%22%3A%22qqwer222%40asd.com%22%2C%22password%22%3A%22qqq%22%2C%22description%22%3A%22%22%2C%22image%22%3A%22%22%7D', {headers: headers});
Why is this happening? I'm newbie with angular and laravel and I didnt find a solution so far. Corse is OK
in your header :
let headers = new HttpHeaders().set('Content-Type','application/json')

POST request is success, but Chrome get XMLHttpRequestError

I'm trying to upload binary file (to Amazon S3) from my localhost Vue page, using Amazon API Gateway with CORS enabled.
Actual POST Request have issued after Preflight Request issued.
And file upload have succeed.
But the POST Request have caught error bellow.
I don't know Why got the error?
Chrome(Version 79.0.3945.79)
got message
Access to XMLHttpRequest at 'https://XXXXXXXXXXX.execute-api.ap-northeast-1.amazonaws.com/dev/upload' from origin 'http://192.168.0.20:8080' has been blocked by CORS policy:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
AXIOS ERROR: Error: Network Error
at createError (createError.js?2d83:16)
at XMLHttpRequest.handleError (xhr.js?b50d:81)
Source code
async upload() {
console.log("file:", this.file);
const axiosConfig = {
headers: {
"Content-Type": "image/png"
}
};
axios
.post("https://XXXXXXXXXX.execute-api.ap-northeast-1.amazonaws.com/dev/upload", this.file, axiosConfig)
.then(res => {
console.log("RESPONSE RECEIVED: ", res);
})
.catch(err => {
console.log("AXIOS ERROR: ", err);
});
Header(Preflight Request)
Request
:authority: XXXXXXXXXX.execute-api.ap-northeast-1.amazonaws.com
:method: OPTIONS
:path: /dev/upload
:scheme: https
accept: */*
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9,ja;q=0.8
access-control-request-headers: content-type
access-control-request-method: POST
origin: http://192.168.0.20:8080
referer: http://192.168.0.20:8080/
sec-fetch-mode: cors
sec-fetch-site: cross-site
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36
Response
access-control-allow-headers: Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token
access-control-allow-methods: DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT
access-control-allow-origin: *
content-length: 0
content-type: application/json
date: Fri, 13 Dec 2019 12:39:40 GMT
status: 200
via: 1.1 88c2e4442XXX3f0dXXX7df6fcXXX37ff.cloudfront.net (CloudFront)
x-amz-apigw-id: EpH19E9sNjMFhOg=
x-amz-cf-id: PEXXXH0x8_mlAspmv-xhi3X3XXXn_LSBswhXXXyqnCGZmVPkXXXYhw==
x-amz-cf-pop: NRT51-C1
x-amzn-requestid: 47XXc915-3b44-4XX7-959a-3XXX62150b3d
x-cache: Miss from cloudfront
Header(Actual POST)
Request
:authority: XXXXXXXXXX.execute-api.ap-northeast-1.amazonaws.com
:method: POST
:path: /dev/upload
:scheme: https
accept: application/json, text/plain, */*
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9,ja;q=0.8
content-length: 6849
content-type: image/png
origin: http://192.168.0.20:8080
referer: http://192.168.0.20:8080/
sec-fetch-mode: cors
sec-fetch-site: cross-site
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36
Response
content-length: 47
content-type: application/json
date: Fri, 13 Dec 2019 12:39:40 GMT
status: 200
via: 1.1 88c2e44426XX3f0db837df6fc92437ff.cloudfront.net (CloudFront)
x-amz-apigw-id: EpH1_EeptjMFXqw=
x-amz-cf-id: XXqDis00oJqvh8wY-a0sugE6tuhwPHiJLs7ucXX5OdPC0uoCql7-nQ==
x-amz-cf-pop: NRT51-C1
x-amzn-requestid: 9XXX54a0-0a71-4cda-9d91-ae90a3322c9f
x-amzn-trace-id: Root=1-5XXX868c-fXXXa33dd82751efXXX547d;Sampled=0
x-cache: Miss from cloudfront
I solved it myself.
I don't know Why got the error?
Because Response header includes NO 'access-control-allow-origin'.
Browser could't read response body by CORB (Cross-Origin Read Blocking).
Added the header to response in Lambda function, it works.
s3.putObject({
Body: requestBody,
Bucket: "xxxxxx.com",
ContentType: "image/png",
Key: "uploadTest/logo.png"
})
.promise()
.then(result => {
const message = JSON.stringify(result);
callback(null, {
body: message,
statusCode: 200,
headers: {
"Access-Control-Allow-Origin": "*"
}
});
});

html fileupload control doesnt upload file in Chrome

I have an asp.net application with a page to upload files (csv file). In this page I have an updatepanel in that I have a html fileupload control.
The fileupload works fine with both IE and Firefox. With chrome, I can see the PostedFile.Filename = "bac.csv",
PostedFile.InputStream.Length = 80
But when I copy the Inputstream to a byte array, all the bytes have zero value. Remember this same code works fine with other browsers.
Fiddler also shows different postdata. see below for Chrome and Firefox data that I see in Fiddler. Clearly, Chrome is not posting the file data. What I am doing wrong and how can I fix it.
Chorme data
POST http://nap1557pdv:8081/Test.aspx HTTP/1.1
Host: nap1557pdv:8081
Connection: keep-alive
Content-Length: 1080
Cache-Control: max-age=0
Authorization: Negotiate YIIHxQYGKwYBBQUCoIIHuTCCB7WgMDAuBgkqhkiC9xIBAgIGCSqGSIb3EgECAgYKKwYBBAGCNwICHgYKKwYBBAGCNwICCqKCB38Eggd7YIIHdwYJKoZIhvcSAQICAQBuggdmMIIHYqADAgEFoQMCAQ6iBwMFACAAAACjggXiYYIF3jCCBdqgAwIBBaEWGxRVUy5HTE9CQUwuU0NIV0FCLkNPTaIyMDCgAwIBAqEpMCcbBEhUVFAbH25hcDE1NTdwZHYudXMuZ2xvYmFsLnNjaHdhYi5jb22jggWFMIIFgaADAgEXoQMCASqiggVzBIIFb90TTnez5nz7PYYCHnFWHoUr0lL7EAB6ZoYVhl57Rw+YPVA4ETppBF7d+loFVEvph67qrU35Ivax10viOxneO+Lfw3MnJyt67jtpr7nLuObPOZ5q8iSgOXC413xymPmsaaUgGdA9Ngvz2pOE8OvEbJr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2aCCfgktjj31hOFpQ==
Origin: http://nap1557pdv:8081
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryoVCxaJFfHyYJTJUZ
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://nap1557pdv:8081/Test.aspx
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: ASP.NET_SessionId=tprepknwc3ejjfvmvewhb3ea
------WebKitFormBoundaryoVCxaJFfHyYJTJUZ
Content-Disposition: form-data; name="ctl07_HiddenField"
------WebKitFormBoundaryoVCxaJFfHyYJTJUZ
Content-Disposition: form-data; name="__EVENTTARGET"
------WebKitFormBoundaryoVCxaJFfHyYJTJUZ
Content-Disposition: form-data; name="__EVENTARGUMENT"
------WebKitFormBoundaryoVCxaJFfHyYJTJUZ
Content-Disposition: form-data; name="__VIEWSTATE"
/wEPZwUPOGNmMDIzYmE5MWZmZTE3yZ1szJcaImr6jsC8aAj3Jr/NJZHuYmM9v1nicrGvr1I=
------WebKitFormBoundaryoVCxaJFfHyYJTJUZ
Content-Disposition: form-data; name="__EVENTVALIDATION"
/wEWAgKZhrWmDwLAtdSqDb+OpffaxhvDEvRAly4rTIajFqtN7G6bde9qDsAeL/uL
------WebKitFormBoundaryoVCxaJFfHyYJTJUZ
Content-Disposition: form-data; name="ctl00$MainContent$fileUploadChartData"; filename="bac.csv"
Content-Type: application/vnd.ms-excel
????????????????????????????????????????????????????????????????????????????????
------WebKitFormBoundaryoVCxaJFfHyYJTJUZ
Content-Disposition: form-data; name="ctl00$MainContent$btnUploadDocument"
Upload
------WebKitFormBoundaryoVCxaJFfHyYJTJUZ--
Firefox Data
POST http://nap1557pdv:8081/Test.aspx HTTP/1.1
Host: nap1557pdv:8081
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
Referer: http://nap1557pdv:8081/Test.aspx
Cookie: ASP.NET_SessionId=i2egjzbii2d4ttz4uhripgz4
Content-Type: multipart/form-data; boundary=---------------------------24464570528145
Content-Length: 1104
-----------------------------24464570528145
Content-Disposition: form-data; name="ctl07_HiddenField"
-----------------------------24464570528145
Content-Disposition: form-data; name="__EVENTTARGET"
-----------------------------24464570528145
Content-Disposition: form-data; name="__EVENTARGUMENT"
-----------------------------24464570528145
Content-Disposition: form-data; name="__VIEWSTATE"
/wEPZwUPOGNmMDIzYzRlZjk0NDk3xSjtNc5KxDS+sptXgXIwFbIwfngQQcicVPd0sZS0Hes=
-----------------------------24464570528145
Content-Disposition: form-data; name="__EVENTVALIDATION"
/wEWAgKes7e9AgLAtdSqDeYF8SG+RG8hp8rFuJK7HrsxNq8TZlkf0m0bUTEzK9Pq
-----------------------------24464570528145
Content-Disposition: form-data; name="ctl00$MainContent$fileUploadChartData"; filename="bac.csv"
Content-Type: application/vnd.ms-excel
Symbol,Date,Open,High,Low,Close,Volume
BAC,4/25/2012,8.21,8.35,8.19,8.23,563453
-----------------------------24464570528145
Content-Disposition: form-data; name="ctl00$MainContent$btnUploadDocument"
Upload
-----------------------------24464570528145--
This is a known issue in Chrome 19.0.1084.46. See http://code.google.com/p/chromium/issues/detail?id=128574
We have exactly the same behaviour (jpeg files containing only NUL values)
We are using IIS webservers with windows authentication and Chrome 19.0.1084.46.
It was introduced tuesday when Google updated chrome..
For now we reverted to using MSIE9