Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API management X-AppService-Proto header causes request body to be empty #6021

Closed
richardweaver opened this issue May 11, 2020 · 4 comments
Closed

Comments

@richardweaver
Copy link

richardweaver commented May 11, 2020

Investigative information

Please provide the following:

  • Timestamp: 2020-05-11T13:10:46.311
  • Function App version: 2.0
  • Function App name:
  • Function name(s) (as appropriate):
  • Invocation ID: 691624e0-d775-41ad-92d1-579ae6397ceb
  • Region: North Europe

Repro steps

My function consumes a POST request with Content-Type as x-www-form-urlencoded:
{ "authLevel": "anonymous", "type": "httpTrigger", "direction": "in", "name": "req", "methods": ["post"] },

In my code I read the posted data using req.rawBody. Posting directly to the function works fine. However, I have this endpoint behind an API Management facade, and when called through that I get an error because req.rawBody is undefined.

Following investigation, when forwarding the request, API Management adds a load of extra HTTP headers. I tried after adding them one at a time to a request in Postman and the one that triggers the issue is X-AppService-Proto: https.

Expected behavior

req.rawBody should be populated whether the request is direct or via API Management.

Actual behavior

req.rawBody is undefined where the request is forwarded via API Management.

Known workarounds

Make requests directly.

Related information

I'm using Javascript, and this function only uses HTTP bindings (trigger and out).

@ghost ghost assigned yojagad May 11, 2020
@richardweaver
Copy link
Author

Possibly related? #6013

@richardweaver
Copy link
Author

Just to update, this happens regardless of the Content-Type, it's also an issue with "application/json" where the body is empty.

@yojagad
Copy link
Contributor

yojagad commented Jul 23, 2020

Apologies for the late response. We're trying to investigate this, can you log the context object (JSON.stringify(context)) and provide us with what it looks like when called directly vs when called through APIM , please ?

@ghost
Copy link

ghost commented Jul 27, 2020

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost ghost closed this as completed Jul 30, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Aug 29, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants