apilayer / goiban-service

Implements a basic REST Web-service for validating IBAN account numbers in GO.
MIT License
134 stars 48 forks source link

HTTP 204 No Content #32

Closed vlec-be closed 4 years ago

vlec-be commented 4 years ago

Hi,

I have a problem when I'm calling OpenIBAN from my server.

$.ajax Query, no method specified (API default is GET) :

https://openiban.com/validate/BExxxxxxxxxxxxxx?validateBankCode=false&getBIC=true

Request

Host: openiban.com User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0 Accept: / Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate, br Access-Control-Request-Method: GET Access-Control-Request-Headers: jquery_context,jquery_request Referer: https://my-server.be:9443/portail/MPER/bourse.do?tkRfhId=1575963241630jqX09 Origin: https://my-server.be:9443 Connection: keep-alive

Response

HTTP/2.0 204 No Content date: Tue, 10 Dec 2019 08:35:05 GMT set-cookie: __cfduid=d9e24e54fa11de99346a207b4d29ed16b1575966905; expires=Thu, 09-Jan-20 08:35:05 GMT; path=/; domain=.openiban.com; HttpOnly access-control-allow-methods: GET, POST, OPTIONS access-control-max-age: 1728000 access-control-allow-origin: * cf-cache-status: DYNAMIC expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" server: cloudflare cf-ray: 542de228efa9bdd7-AMS X-Firefox-Spdy: h2

Thanks

fourcube commented 4 years ago

Hi,

I've tried to replicate your problem here: https://repl.it/@fourcube/openiban-jquery. Unfortunately, I wasn't able to.

vlec-be commented 4 years ago

Hello,

We are using jQuery 3.2.1 I tried with multiple belgian IBAN accounts (Belfius and Axa).

$.ajax({ url: 'https://openiban.com/validate/' + ls_ibanVal, data: { "validateBankCode": false, "getBIC": true } }) .done( ... ) .fail( ... );

It's the same if I put this on one line

$.ajax({ url: 'https://openiban.com/validate/' + ls_ibanVal + "?validateBankCode=false&getBIC=true" })

Or without specifying the URL parameter. It directly goes in the fail handler function. For your information it's a local server but I have the same issue on our production server

fourcube commented 4 years ago

@blacklord049 The problem you encounter is caused by a failed CORS preflight request. I've updated the server configuration to include the access-control-allow-headers: * HTTP header in the preflight response.

Could you please try again and see if it works now?

vlec-be commented 4 years ago

Nice it's working again! :)