0

I have server running on localhost:8080 (localhost:3000 request is redirected to localhost:8080 by proxy definition in package.json) and sending requests from ReactJS app to this server on localhost. In all browsers suddenlly started occuring this problem. Requests (except keepalive request and 1 or 2 others) return 400 but does not reach server at all. E. g. in Chrome it is happening for all requests but in Firefox a few requests return status code 200 and response with data without problem but other requests behave as mentioned above.

I am using Windows 10.

All browsers have problems: Chrome, Firefox, IE, Edge, Opera, Chromium

I tried turning off defender firewall and AVG.

Request examples:

Chrome

Request URL: http://localhost:3000/api/essp/database?pageSize=1000
Request Method: GET
Status Code: 400 Bad Request
Request Headers:
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: cs-CZ,cs;q=0.9
authorization: Bearer (token hidden for privacy reasons)
authorizationjwt: Bearer (token hidden for privacy reasons)
Connection: keep-alive
content-type: application/json
Cookie: _ga=GA1.1.1056630521.1566899267
Host: localhost:3000
Referer: http://localhost:3000/systematic-evidence
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36

Same request but in Firefox

Request URL: http://localhost:3000/api/essp/database?pageSize=1000
Request Method: GET
Status Code: 200 OK
Request Headers:
Accept  
*/*
Accept-Encoding 
gzip, deflate
Accept-Language 
cs,sk;q=0.8,en-US;q=0.5,en;q=0.3
Authorization   
Bearer (token hidden for privacy reasons)
Authorizationjwt    
Bearer (token hidden for privacy reasons)
Connection  
keep-alive
Content-Type    
application/json
Cookie  
_ga=GA1.1.647499021.1563197779
Host    
localhost:3000
Referer 
http://localhost:3000/systematic-evidence
User-Agent  
Mozilla/5.0 (Windows NT 10.0; …) Gecko/20100101 Firefox/68.0

Different request in Firefox (400 is returned also in Chrome for this request)

Request URL: http://localhost:3000/api/essp/database/136adc97-75f7-4235-a48f-32e01c0f6add
Request Method: GET
Status Code: 400 Bad Request
Request Headers:
Accept  
*/*
Accept-Encoding 
gzip, deflate
Accept-Language 
cs,sk;q=0.8,en-US;q=0.5,en;q=0.3
Authorization   
Bearer (token hidden for privacy reasons)
Authorizationjwt    
Bearer (token hidden for privacy reasons)
Connection  
keep-alive
Content-Type    
application/json
Cookie  
_ga=GA1.1.647499021.1563197779
Host    
localhost:3000
Referer 
http://localhost:3000/systemat…97-75f7-4235-a48f-32e01c0f6add
User-Agent  
Mozilla/5.0 (Windows NT 10.0; …) Gecko/20100101 Firefox/68.0

I am not BE developer but I was told it is not problem on server (on localhost), it is just something in my computer. What could be causing this problem? Could it be something in Windows or some application intervenes to requests and returns 400 without reaching server? How am I able to find out or solve this problem?

Thanks for any helpfull answer

EDIT: Not CORS problem because requests returning 400 are not reaching server at all. And also some non-simple requests return 200 without problem in few browsers (e. g. Firefox).

SOLUTION: Solved by restoring Windows to factory settings.

Spook
  • 331
  • 1
  • 6
  • 16
  • Possible duplicate of [Understanding CORS](https://stackoverflow.com/questions/25845203/understanding-cors) – Alexander Staroselsky Sep 02 '19 at 15:12
  • If you do not enable CORS on the backend server, non-simple requests will all fail with 400 error code. Please share the code that enables CORS on your backend. – Alexander Staroselsky Sep 02 '19 at 15:13
  • It is not CORS problem, everything was working correctly for more than a year. From day to day there is problem without any change to be in every browser on my computer. And as I mentioned, some non-simple requests in some browsers returns 200 without problem. And also requests returning 400 did not reach server because there was nothing in server log as our backend developer showed me (connected to my computer and using debugger). – Spook Sep 02 '19 at 15:59
  • This is extremely difficult to troubleshooting what is happening on your machine. A 400 error would be generated by a server, not webpack dev server. We have no information on your backend or the proxy configuration. I would recommend to add a fallback route on the server and review the request/response headers, because the server seems to be responding with a status, a 400, regardless of the logs you mentioned. Please add information regarding the proxy configuration, the server endpoint including CORS configuration, as well as the actual error message displayed in the browser. – Alexander Staroselsky Sep 02 '19 at 23:41

0 Answers0