-
Notifications
You must be signed in to change notification settings - Fork 0
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃摑Coding Notes #24
Comments
Forwarded Headers And DockerWhen you deploy aspnet core app with docker and use reverse proxy with forwarded header middleware in app, there is a problem that forwarded header middleware may not regard forwarded headers or replace the http context. I made a basic investigation. Here is the reason I figure out and it may not be completely correct. Aspnet core began to ignore forwarded headers when the original request ip is not in the allowed list from some version. By default allowed ip is only loopback. However it seems when running in docker a individual network is established and requests from proxy server are like external requests so aspnet core ignore forwarded headers. The solution is to explicitly make aspnet core trust the requests. Like this if (string.Equals(System.Environment.GetEnvironmentVariable("ASPNETCORE_FORWARDEDHEADERS_ENABLED"), "true", StringComparison.OrdinalIgnoreCase))
{
var options = new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.XForwardedFor |
ForwardedHeaders.XForwardedProto
};
// Only loopback proxies are allowed by default.
// Clear that restriction because forwarders are enabled by explicit
// configuration.
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
app.UseForwardedHeaders(options);
} Remember to define environment variable |
The source map generated with |
Be careful when using react hooks and rxjs. Hooks may create a new observable for each update making some function like |
Be careful with signalr behind nginx. It needs special configuration. See this for example. |
A lesson learned at the cost of blood, never refactor thoroughly at one time. Do it slowly and progressively! |
There is currently a bug in parceljs. If you want to proxy ws in dev server, you should use a different hmr port from dev server port. See details in parcel-bundler/parcel#6994. Hope the bug can be fixed soon. (I won't tell you that I spent several hours to find the problem.馃槶) |
Some tips about reactjs:
|
I love and hate coding at the same time! 馃ぃ
The text was updated successfully, but these errors were encountered: