-
Notifications
You must be signed in to change notification settings - Fork 834
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
Unable to use Yarp on Azure App Services? #2066
Comments
Glancing at Cocoon's implementation, I suspect you are forwarding the request's host header as-is. Assuming you don't have access to YARP's transforms, you can try setting context.Request.Headers.Host = default; before proxying the request (e.g. in the first middleware that runs), and YARP will use |
Thanks for the suggestion @MihaZupan, will investigate |
Triage: Seems to be answered. 9 days no response. Closing. |
@MihaZupa many thanks for your excellent suggestion - it was the Host header that was the culprit! I believe the Azure front-end uses the Host header value to direct the correct App Service - so when the request is made to |
Scenario
We use a library called Cocoon which utilizes YARP 1.1 to proxy requests to a .NET 6 application to an older WebForms application. It's running fine on our hosted servers - the NET 6 application proxies requests to an internal IP address on a port using HTTP.
Azure Problems
We wish to port our application to Azure App Services, so I set up a DevOps release pipeline to create two App Services hosted on a Windows App Service Plan, in the same region. The parent NET 6 application is then configured to proxy traffic to the WebForm app. I used the Azure domain names for each service with HTTPS for both sites. Both apps are running fine when queried directly.
All proxied requests to the WebForms app fail with a 400 status code, even requests for static content. I've tried to add more logging to see what's going wrong, but I've not figured out any more than a 400 status code.
What I've Tried
http://
and turned off HTTPS Only on the WebForm app in case it was related to SSL.Log
Below is the log from the NET 6 application when it tried to request a proxied resource (in this case a static image
/img/DefaultLogojpg
). It starts the request and first makes a call to the remote URIhttps://webform-site-url/facadeauth
which is a Cocoon check for authentication status on the WebForm app. This returns 401 which is correct since the user isn't logged in - so this part of the operation worked correctly and did request the remote resource.It then gets a 400 error on requesting the actual resource, and it seems to be repeated several times (it might be a retry option in Cocoon/YARP?). The image being requested does not require authentication as it's a static file.
If there are any other tests or YARP configurations I can try, or specific logging I can perform to diagnose the cause I'm welcome to suggestions as I've been stuck on this for several days.
The text was updated successfully, but these errors were encountered: