Oracle UTL_HTTP bad request with ngixx

263 Views Asked by At

I've a ngnix as a reverse proxy with the next entry:

 location /jrri/ {
    proxy_pass http://xxx.xxx.xxx.xxx:8080/;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

if I call to https://www.mysite.com.ar:443/jrri from a web broweser or curl I get the result 200 ok.

curl --head https://www.mysite.com.ar:443/jrri/
HTTP/1.1 200
Server: nginx/1.20.1
Date: Mon, 26 Jul 2021 19:00:54 GMT
Content-Type: text/html;charset=UTF-8
Connection: keep-alive

but if I call from oracle procedure I get the error code 400 - Bad request

  DECLARE
    l_text VARCHAR2(32767);
    req utl_http.req;
  BEGIN
    UTL_HTTP.SET_WALLET('');
     l_text := UTL_HTTP.REQUEST('https://www.mysite.com.ar:443/jrri/');
    dbms_output.put_line(l_text);
  END;

Response:

<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.20.1</center>
</body>
</html>

My Oracle version is a autonomous database , what is wrong?

regards

1

There are 1 best solutions below

0
Pedro Luque On

I find the problem, for any raeson if you wirte the port into the request the server return bada request. If I write UTL_HTTP.REQUEST('https://www.mysite.com.ar/jrri/'); without the port it work!!