Hi Community,
I am using Verify API Key Policy and everything is working if I made a request using curl.
e.g.:
curl -X GET "https://myapi.net/api/v1/resource/id" -H "accept: application/fhir+json" -H "x-api-key: apikey"
And for this request I can see on Apigee trace tool the follow headers :
Request Received from Client
GET /api/v1/resource/id
Request Headers |
|---|
|
accept |
application/fhir+json |
|---|---|
|
Host |
|
|
User-Agent |
curl/7.47.0 |
|
x-api-key |
apikey |
|
X-Forwarded-For |
xxx.xxx.xxx.xxx |
|
X-Forwarded-Port |
443 |
|
X-Forwarded-Proto |
https |
However when I make the same request from my api using Portals it’s not working. I’m using a swagger:
From this request I got the follow on trace:
| ### Request Received from Client #### OPTIONS /api/v1/resource/id |
|---|
| #### Request Headers |
| text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 |
| gzip,deflate,br |
| en-US,en;q=0.5 |
| x-api-key |
| GET |
| myapi.net |
| https://developers.portal.net |
| Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0 |
| xxx.xxx.xxx.xxx |
| 443 |
| https |
I’ve tested the same swagger yaml file using swaggerhub.com to make the request and from there its working fine.
From trace and making the request using swaggerhub.com I’ve got the follow:
Request Received from ClientGET /api/v1/resource/id |
Response Sent to Client200 |
Request Headers |
Response Headers |
|---|
|
accept |
application/json |
|---|---|
|
accept-encoding |
gzip,deflate,br |
|
accept-language |
en-US,en;q=0.5 |
|
Content-Length |
0 |
|
Host |
|
|
if-none-match |
W/“OFqI5mfTK+p+0KxTJX+PZw==” |
|
referer |
|
|
user-agent |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0 |
|
x-amzn-trace-id |
Root=1-5aa105c4-91f63b2e3804baf0c111579e |
|
x-api-key |
apikey |
|
X-Forwarded-For |
xxx.xxx.xxx.xxx, xxx.xxx.xxx.xxx |
|
X-Forwarded-Port |
443 |
|
X-Forwarded-Proto |
https |
I’ve noticed that when I made the request from curl, and swaggerhub I can see the x-api-key header on request but not by portals.
Thanks in advance if you can help me. And if you need more details, please just ask. Let me know if you guys need me to paste some xml configuration from my proxy api.
Thank you