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

Custom Headers Not Applied in Azure Function App Settings #10557

Open
dellch opened this issue Oct 22, 2024 · 1 comment
Open

Custom Headers Not Applied in Azure Function App Settings #10557

dellch opened this issue Oct 22, 2024 · 1 comment
Assignees

Comments

@dellch
Copy link

dellch commented Oct 22, 2024

Is your question related to a specific version? If so, please specify:

Azure Functions (linux) - Runtime version: 4.636.0.0

What language does your question apply to? (e.g. C#, JavaScript, Java, All)

We're using C# - although this may apply to All languages as it relates to the configuration of HTTP headers using host.json and Application Settings.

Question

I am trying to override `host.json values configure custom HTTP headers for my Azure Function App via app settings, but I am not seeing the headers in the HTTP response. I have attempted the following approaches:

  1. Adding a custom header XCustomHeader using the key AzureFunctionsJobHost__extensions__http__customHeaders_XCustomHeader with a value of TestHeaderValue, but this header is not present in the response.

  2. Using key AzureFunctionsJobHost__extensions__http__customHeaders with an escaped JSON as the value

Despite these efforts, none of the custom headers are reflected in the response.

Is there a limitation in how the Azure Functions platform processes these headers when defined in app settings?

Steps to reproduce

  1. Add the following app setting in the Azure Portal using Advanced Edit:
  • Method 1:
    {
        "name": "AzureFunctionsJobHost__extensions__http__customHeaders_XCustomHeader",
        "value": "TestHeaderValue",
        "slotSetting": false
    }
    • Method 2:
      {
          "name": "AzureFunctionsJobHost__extensions__http__customHeaders",
          "value": "{\"Content-Security-Policy\": \"default-src 'self';\", \"Permissions-Policy\": \"accelerometer=(), autoplay=();\"}",
          "slotSetting": false
      }
  1. Save the configuration and restart the Function App.
  2. Navigate to the function app

Expected behavior

The custom headers (XCustomHeader, Content-Security-Policy, etc.) should be present in the HTTP response.

Actual behavior

None of the custom headers are applied to the response

@bhagyshricompany
Copy link

Hi @dellch Thanks for update as I checked it occurring will update you on this asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants