Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on Post Request #16

Closed
SP105 opened this issue Nov 24, 2014 · 13 comments
Closed

Error on Post Request #16

SP105 opened this issue Nov 24, 2014 · 13 comments

Comments

@SP105
Copy link

SP105 commented Nov 24, 2014

Hi, I'm using the proxy for a mobile app with phonegap. I can do the GET request with any problem, but when I'm doing the POST request, the response is the following: "Not found because of proxy error: Error: CERT_HAS_EXPIRED"

The header is this:

24-11-2014 16-58-40

@Rob--W
Copy link
Owner

Rob--W commented Nov 24, 2014

Could you paste an example of the request: URL, headers, request payload (POST data)?

@SP105
Copy link
Author

SP105 commented Nov 24, 2014

Sure.. Here is an image of the header response:

24-11-2014 16-58-40

I'm running my app on Blackberry Z10, the image capture is from the web inpector and the response is this: "Not found because of proxy error: Error: CERT_HAS_EXPIRED".

The URL requestet its working, I test the same request on a RESTClient on firefox and work OK.
Thanks in advance!

@Rob--W
Copy link
Owner

Rob--W commented Nov 24, 2014

In a copy-pasteable format, please.

@SP105
Copy link
Author

SP105 commented Nov 24, 2014

Sorry, here:

Request URL:https://cors-anywhere.herokuapp.com/https://qa.sisa.msal.gov.ar/sisaqa/services/rest/seguridad/autenticar
Request Method:POST
Status Code:404 Not Found

Request Headers
Accept:/
Accept-Language:es-ES,es;q=0.8
Access-Control-Allow-Origin:*
Content-Type:application/json
Origin:local://
User-Agent:Mozilla/5.0 (BB10; Touch) AppleWebKit/537.35+ (KHTML, like Gecko) Version/10.2.1.1925 Mobile Safari/537.35+
X-Requested-With:XMLHttpRequest

Request payload
{"credenciales":{"usuario":"uutn","clave":"12345"}}

Response Headers
Access-Control-Allow-Origin:*
Connection:keep-alive
Date:Mon, 24 Nov 2014 20:54:29 GMT
Server:Cowboy
Transfer-Encoding:chunked
Via:1.1 vegur

@Rob--W
Copy link
Owner

Rob--W commented Nov 24, 2014

The error appears to be correct. The server's certificate has been expired (on 2014-01-17 13:07:54 GMT). Below is what I get if I make a request with curl (and the --insecure flag to ignore certificate errors).

This is not an issue with cors-anywhere, the target server should be configured correctly (update the SSL certificate).

$ curl https://qa.sisa.msal.gov.ar/sisaqa/services/rest/seguridad/autenticar -X POST -H 'Accept:*/*' -H 'Accept-Language:es-ES,es;q=0.8' -H 'Access-Control-Allow-Origin:*' -H 'Content-Type:application/json' -H 'Origin:local://' -H 'User-Agent:Mozilla/5.0 (BB10; Touch) AppleWebKit/537.35+ (KHTML, like Gecko) Version/10.2.1.1925 Mobile Safari/537.35+' -H 'X-Requested-With:XMLHttpRequest' -d '{"credenciales":{"usuario":"uutn","clave":"12345"}}' -H 'Content-Length: 51' -vvv --insecure
* Hostname was NOT found in DNS cache
*   Trying 190.220.135.83...
* Connected to qa.sisa.msal.gov.ar (190.220.135.83) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using TLSv1.0 / DHE-RSA-AES256-SHA
* Server certificate:
*        subject: C=AR; ST=Buenos Aires; L=CABA; O=SISA; CN=*.sisa.msal.gov.ar
*        start date: 2011-03-30 13:07:54 GMT
*        expire date: 2014-01-17 13:07:54 GMT
*        issuer: C=AR; ST=Buenos Aires; L=CABA; O=SISA; CN=*.sisa.msal.gov.ar
*        SSL certificate verify result: self signed certificate (18), continuing anyway.
> POST /sisaqa/services/rest/seguridad/autenticar HTTP/1.1
> Host: qa.sisa.msal.gov.ar
> Accept:*/*
> Accept-Language:es-ES,es;q=0.8
> Access-Control-Allow-Origin:*
> Content-Type:application/json
> Origin:local://
> User-Agent:Mozilla/5.0 (BB10; Touch) AppleWebKit/537.35+ (KHTML, like Gecko) Version/10.2.1.1925 Mobile Safari/537.35+
> X-Requested-With:XMLHttpRequest
> Content-Length: 51
> 
* upload completely sent off: 51 out of 51 bytes
< HTTP/1.1 200 OK
< Date: Mon, 24 Nov 2014 21:02:00 GMT
< Content-Type: application/octet-stream
< Content-Length: 58
< Connection: close
< 
* Closing connection 0
* SSLv3, TLS alert, Client hello (1):
{"estado":"ERROR_AUTENTICACION : Error de autenticacion!"}

@SP105
Copy link
Author

SP105 commented Nov 24, 2014

Thanks for the quick response!!!
So is there any way to skip this kind of error? I'm not able to configure the server....

Anyway, thanks again!

@Rob--W
Copy link
Owner

Rob--W commented Nov 24, 2014

You could put an instance of cors-anywhere on an own server (e.g. using Heroku, see README.md in this repository for more information), and add the following environment variable: NODE_TLS_REJECT_UNAUTHORIZED=0 to ignore certificate errors. Note: This option defeats the purpose of https.

E.g. after setting up a Heroku instance, run the following command:

heroku config:set NODE_TLS_REJECT_UNAUTHORIZED=0

@SP105 SP105 closed this as completed Nov 24, 2014
@SP105 SP105 reopened this Nov 24, 2014
@SP105 SP105 closed this as completed Nov 24, 2014
@SP105
Copy link
Author

SP105 commented Nov 24, 2014

Thanks!

@claudiosantos92
Copy link

im having the same error but i dont understand where do i need to insert this in the server code "NODE_TLS_REJECT_UNAUTHORIZED=0"

@rizkhal
Copy link

rizkhal commented Dec 5, 2020

i have the same problem in vps, i am using jquery for call external API but get the same error, how i can fix it?

@imsourya
Copy link

imsourya commented Apr 6, 2022

I was trying from browser and getting this => Error: unable to get local issuer certificate
I solved this issue by just one change in the cor-anywhere code

in file cors-anywhere.js at line 418 Just change the line

process.env.NODE_TLS_REJECT_UNAUTHORIZED !== '0',

to

process.env.NODE_TLS_REJECT_UNAUTHORIZED == '0',

It worked!

@Rob--W
Copy link
Owner

Rob--W commented Apr 6, 2022

@imsourya
You shouldn't be changing the implementation like that, but set the NODE_TLS_REJECT_UNAUTHORIZED=0 environment variable before starting the library.

@imsourya
Copy link

imsourya commented Apr 6, 2022

@imsourya You shouldn't be changing the implementation like that, but set the NODE_TLS_REJECT_UNAUTHORIZED=0 environment variable before starting the library.

Yes @Rob--W , You are right, We shouldn't change the code, Actually I was facing problem in setting environment variable in windows system so tried using this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants