Azure Function App remove headers set by a Nest.js App - azure

Thanks for the time reading this.
I am developing an App using Nest.js framework, running it on Azure App service.
I am using a library which set some headers before sending the response to the client.
When I run my code on local runtime, everything seems working properly.
But, when I use Azure Function App local runtime, headers seems to disappear.
There is a screenshot of the request using local runtime
As you can see in the “Response Headers” section there some headers set.
And then a screenshot of the same server code running on Azure Function App local runtime
As you can see in the “Response Headers” section some headers are missing.
My question is, how do I configure Azure Function App so that it does not remove headers set by my Nest.js App ?
I’ve been looking into MS documentation about that, but I did not find anything.
Thank you. for your help

Related

A released Blazor WebAssembly application redirects API calls to pages instead of the API controller

I have a Blazor Wasm application with a Client and a Server project. The Client gets is data from the Server by using an api-call. However, when I publish the application to Azure it doesnt work.
Running in Visual Studio:
https://localhost:{number}/api/Project/GetAll returns the expected json.
Published in Azure:
https://{website}.azurewebsites.net/api/Project/GetAll returns the content of the index.html
I think it has something to do with routing but I cannot figure it out.
Note: when I run the project in Release-modus (which accesses the database in Azure) it works as expected.
Thanks for any help!

Azure Node.js Linux App Service Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Request body too large

We are using Azure Node.js Linux App service, we are running into below error when we try uploading large files ~30MB
Do we have any setting to change the request body size?
Thanks for asking question! The CORS middleware container currently has a limitation on the size of the request you can send and disabling the CORS setting may fix the issue.
Checkout KestrelServerLimits.MaxRequestBodySize Property for more details.
You may also want to look this article: https://learn.microsoft.com/en-us/azure/app-service/app-service-web-nodejs-best-practices-and-troubleshoot-guide

How do I deploy Apollo client and Node Express/Sequelize API?

I have an Apollo app with an express/sequelize API. It runs fine in dev. Can anyone tell me what it should look like in prod? Ive added .env environment variables. Where do those get set on the web server? Do I change the url in Apollo client? How do I build/prepare the API for deployment to web server through FTP? I use bitbucket for CI/CD. I really don't what I'm supposed to do.
So basically the answer is, with Node, you can't just deploy to a static server and expect it to work. The app created is already it's own server. Therefore, you have to host on in a service like AWS, Heroku or Now to get it to work. This may seem obvious to some but at first this wasn't clear to me.

Application Insights - how to exclude localhost

I have added application insights by standard way to my application, it works fine, I collect telemetry data from local website and from working project, published on Azure. But there are many data is sent from localhost, how can I say to not send any data from localhost? Thank you
As Brendan said, you could remove InstrumentationKey in ApplicationInsights.config on your localhost and set it only for release version in code:
TelemetryConfiguration.Active.InsrumentationKey = "MyKey" .
Also, you could Disabling telemetry by setting the following code as this article said.
TelemetryConfiguration.Active.DisableTelemetry = true;
For more detail about how to ignore localhost on Application Insights, you could refer to this case.

Using API Apps with Swagger in dev/test/production environments

I'm migrating a combined Azure Website (with both Controllers and ApiControllers) to a split Web App and API App. Let's call it MyApp.
I've created MyAppDevApi, MyAppTestApi, and MyAppProductionApi API Apps (in different App Services) to host the three environments, expecting to promote code from one environment to another.
So far, I've only deployed to MyAppDevApi, since I'm just getting started.
When I do Add/Azure API App Client to my UI-only project to start referring to the API app, and I point it to MyAppDevApi, it uses AutoRest to create classes in my code. These classes now all have the name MyAppDevApi, rather than just MyAppApi, which is the actual namespace of the code I'm deploying to every environment. Obviously, I can't check that in... how can I promote that through Test and Prod?
There's nothing in the Swagger JSON that refers to this name, so it must be on the AutoRest side (I think).
Has anyone come up with a strategy or work-around to deal with this multiple-environment promotion issue with API Apps?
Edit
So far the best thing I've come up with is to download the Swagger from the API App to a local file (which, again, has only the namespace from the original code, not from the name of the API App), and then import it into the Web App. This will generate classes in the Web App that have the naming I expect.
The problem is that I then have to edit the generated MyAppApi.cs file's _baseUri property to pull from an AppSetting, have the different web.config.dev, .test, .prod, and then do the web.config transform. I mean, that'll work, but then every time I change the API App's interface, I'll regenerate... and then I'll have remember to change the _baseUri again... and someone, sometime is going to forget to do this and then deploy to production. It's really, really fragile.
So... anyone have a better idea?
I'm not quite sure why you're creating three different apps, one for each environment? One application is fine and use web.config transforms for each environment. This is the general way I do all of my apps and works fine.
Information about how to apply web.config transforms can be found here which may help in your situation.
Hope that helps.
Well, here's how I've solved this:
Download Swagger file from API App to local hard drive.
Import local Swagger file into Web App to generate classes that have the naming from my code, not from the environment.
Use AppSettings to specify the environment-specific settings to point to the API App. This can be either a web.config transform, or you can just specify them in the Azure Portal on the Web App in Application Settings.
Instantiate the generated API App Client using the constructor that takes in a URL to point to the API App (these are at class level, hence static):
private readonly static Uri apiAppUrl = new Uri(CloudConfigurationManager.GetSetting("ApiAppUrl"));
private readonly static MyAppApi myAppApi = new MyAppApi(apiAppUrl);
I'd still love a solution to this that doesn't require downloading the Swagger file, but, all in all, if that's the only workaround necessary, it's not all that bad.

Resources