Hi Forum,
I am trying to set reverse proxy but it is not working, I can get the Token when I pass URL(POST) and body in Postman
https://ida2.xxx.com/adfs/oauth2/token
grant_type=password&client_id=PC-23456-X046986-276704-UAT&username=v&password=password&resource=XXX:URI:RS-89764-136268-LOBGESUAT-UAT
I need to pass this as request body in nginx.conf but I am not having any luck, My nginx.conf looks like this:
cat nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
#access_log /var/log/nginx/access.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
server_name localhost;
location /gettoken {
proxy_set_header grant_type "password";
proxy_set_header client_id "PC-23456-X046986-276704-UAT";
proxy_set_header username "AD\\X046986";
proxy_set_header password "password";
proxy_set_header resource "XXX:URI:RS-89764-136268-LOBGESUAT-UAT";
proxy_pass https://ida2.xxx.com/adfs/oauth2/token;
}
}
}
When I run curl command to gettoken it is failing with 403 Forbidden, is this the correct way of passing request body in nginx.conf?
curl -k -v http://localhost:8080/gettoken
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /gettoken HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.61.1
> Accept: */*
>
< HTTP/1.1 403 Forbidden
< Server: nginx/1.14.1
< Date: Mon, 05 Aug 2024 03:04:40 GMT
< Content-Type: text/html
< Content-Length: 48
< Connection: keep-alive
<
* Connection #0 to host localhost left intact
<p>No client id parameter. <./p>
Thanks in advance