VisualReCode / Cocoon

An implementation of the Strangler Fig pattern for ASP.NET Core
Apache License 2.0
62 stars 10 forks source link

Conficient/fix#30 host header #32

Open conficient opened 1 year ago

conficient commented 1 year ago

When using Azure as a host for both a Cocoon and Legacy website, the host header set in the request should not be copied to the proxied request. If it is this causes Azure to redirect the request back to the Cocoon website causing a 400 bad request error.

This option is not required when using local development so I have added a new HostHeaderOption value to the CocoonProxyOptions class. This defaults to the current Cocoon behaviour so is a benign change for anyone unaffected by the problem.

When the Cocoon site is running on Azure App Service, the HostHeaderOption should be set to HostHeaderOptions.SetDefault.

I also added a third behaviour which sets the Host to the value of the DestinationPrefix URL of the proxy although I have not found a scenario where I needed this.