eric
eric

Reputation: 1887

Prevent XMLHTTPRequest from encoding url

I am currently trying to use a very old web app (+15 years) that is talking to a proprietary webserver. Unfortunately I have run into a blocker issue I am unable to solve using modern javascript.

During the login process a GET request is sent via XMLHTTPRequest to the server. Unfortunately the modern browser automatically encode the URL. Old IE11 (and previous) however do not encode the URL. The same can be easily reproduced with curl - that by default also does not touch the URL and just sent it as-is (even if it is not a proper URL)

Old Browser Behaviour:

curl 'http://192.168.20.77/?<REQ><LOGIN><userID>admin:1234</userID></LOGIN></REQ>'
-> WORKS!

Modern Browser Behaviour:

curl 'http://192.168.20.77/?%3CREQ%3E%3CLOGIN%3E%3CuserID%3Eadmin:1234%3C/userID%3E%3C/LOGIN%3E%3C/REQ%3E'
-> DOES NOT WORK!

Is there any workaround to prevent modern browser from encoding the URL before sending it? Or any alternative approach for a web app? Security is not a concern, everything is happening locally on a separate network.

Unfortunately fixing/updating the proprietary webserver is not an option.

Upvotes: 1

Views: 371

Answers (1)

Quentin
Quentin

Reputation: 943556

There are no client-side work arounds. The only thing you could do is to make a request to a server you control and have it act as a proxy that transforms the request so the URL is broken in the way the final server demands.

Upvotes: 1

Related Questions