Git Product home page Git Product logo

cocoon's People

Contributors

conficient avatar markrendle avatar therubble avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cocoon's Issues

Error `Failed to deserialize ReCode.Cocoon.Proxy.Authentication.MessagePrincipal` on Blazor Server NET6

Trying out Cocoon with a Blazor Server using NET 6 with

    <PackageReference Include="ReCode.Cocoon.Proxy" Version="1.0.15-beta1" />
    <PackageReference Include="ReCode.Cocoon.Proxy.BlazorServer" Version="1.0.15-beta1" />

This is pointing at a plain AspNet Webforms site. Getting the error:

2021-11-11T12:27:23.1887908+00:00 0HMD51QDOHLGG:00000001 [ERR] Failed to deserialize ReCode.Cocoon.Proxy.Authentication.MessagePrincipal value. (d55bba89)
MessagePack.MessagePackSerializationException: Failed to deserialize ReCode.Cocoon.Proxy.Authentication.MessagePrincipal value.
 ---> MessagePack.MessagePackSerializationException: Unexpected msgpack code 239 (negative fixint) encountered.
   at MessagePack.MessagePackReader.ThrowInvalidCode(Byte code)
   at MessagePack.MessagePackReader.ReadArrayHeader()
   at MessagePack.Formatters.ReCode_Cocoon_Proxy_Authentication_MessagePrincipalFormatter1.Deserialize(MessagePackReader& reader, MessagePackSerializerOptions options)
   at MessagePack.MessagePackSerializer.Deserialize[T](MessagePackReader& reader, MessagePackSerializerOptions options)
   --- End of inner exception stack trace ---
   at MessagePack.MessagePackSerializer.Deserialize[T](MessagePackReader& reader, MessagePackSerializerOptions options)
   at MessagePack.MessagePackSerializer.DeserializeFromSequenceAndRewindStreamIfPossible[T](Stream streamToRewind, MessagePackSerializerOptions options, ReadOnlySequence`1 sequence, CancellationToken cancellationToken)
   at MessagePack.MessagePackSerializer.DeserializeAsync[T](Stream stream, MessagePackSerializerOptions options, CancellationToken cancellationToken)
   at ReCode.Cocoon.Proxy.Authentication.CocoonAuthenticationClient.DeserializePrincipal(Stream stream)
   at ReCode.Cocoon.Proxy.Authentication.CocoonAuthenticationClient.AuthenticateAsync(HttpRequest request)

This is followed by

2021-11-11T12:27:23.1941785+00:00 0HMD51QDOHLGG:00000001 [INF] "Cocoon" was not authenticated. Failure message: "Failed to deserialize ReCode.Cocoon.Proxy.Authentication.MessagePrincipal value." (48071232)

Running on Windows 10, and the Blazor Server app is using Kestrel. I tried using IIS Express for the Blazor app but it does not run, so not sure what the issue is.

400 error when hosted on Azure?

We have a legacy WebForms app and Blazor Server front-end using Cocoon successfully for a year. It's hosted on our own servers at present and its working perfectly.

Problem

I'm trying to port the same code to be hosted on Azure. I've set up two App Services running in the same service plan (both as Windows hosts). One is running the WebForm app (on .NET Framework 4.8) and the other running Blazor (on .NET 6).

Both apps are up and running independently, but if I try to access a Cocoon page from the Blazor app, it returns a 400 error.

This is the case even if I try to request a static resource, e.g. /img/Test.jpg. This exists on the WebForm app, but it fails and returns a 400 error. From the Blazor site log (below) I can see that it Initially tries to request the /facadeauth route on the target, even though it's accessing a static file, which returns a 401 error. I can query the URL on the webform site, e.g. https://webform-site-url/img/Test.jpg and it works.

2023-03-09 16:45:27.314 +00:00 [INF] Executing endpoint '/{**catch-all}'
2023-03-09 16:45:27.314 +00:00 [INF] Proxying to https://webform-site-url/img/Test.jpg HTTP/2 RequestVersionOrLower no-streaming
2023-03-09 16:45:27.328 +00:00 [INF] Request starting HTTP/1.1 GET https://blazor-site-url/img/Test.jpg - -
2023-03-09 16:45:27.329 +00:00 [INF] Start processing HTTP request GET "https://webform-site-url/facadeauth"
2023-03-09 16:45:27.330 +00:00 [INF] Sending HTTP request GET "https://webform-site-url/facadeauth"
2023-03-09 16:45:27.334 +00:00 [INF] Received HTTP response headers after 3.1655ms - 401
2023-03-09 16:45:27.335 +00:00 [INF] End processing HTTP request after 5.6275ms - 401
2023-03-09 16:45:27.336 +00:00 [INF] Executing endpoint '/{**catch-all}'
2023-03-09 16:45:27.336 +00:00 [INF] Proxying to https://webform-site-url/img/DefaultLogo.jpg HTTP/2 RequestVersionOrLower no-streaming
2023-03-09 16:45:27.345 +00:00 [INF] Received HTTP/1.1 response 400.
2023-03-09 16:45:27.346 +00:00 [INF] Executed endpoint '/{**catch-all}'
2023-03-09 16:45:27.347 +00:00 [INF] Request finished HTTP/1.1 GET https://blazor-site-url/img/DefaultLogo.jpg - - - 400 0 - 18.8249ms
2023-03-09 16:45:27.348 +00:00 [INF] Received HTTP/1.1 response 400.
2023-03-09 16:45:27.349 +00:00 [INF] Executed endpoint '/{**catch-all}'
2023-03-09 16:45:27.350 +00:00 [INF] Request finished HTTP/1.1 GET https://blazor-site-url/img/DefaultLogo.jpg - - - 400 0 - 43.3374ms
2023-03-09 16:45:27.351 +00:00 [INF] Received HTTP/1.1 response 400.
2023-03-09 16:45:27.351 +00:00 [INF] Executed endpoint '/{**catch-all}'
2023-03-09 16:45:27.352 +00:00 [INF] Request finished HTTP/1.1 GET https://blazor-site-url/img/DefaultLogo.jpg - - - 400 0 - 74.3990ms
2023-03-09 16:45:27.354 +00:00 [INF] Received HTTP/1.1 response 400.
2023-03-09 16:45:27.364 +00:00 [INF] Executed endpoint '/{**catch-all}'
2023-03-09 16:45:27.365 +00:00 [INF] Request finished HTTP/1.1 GET https://blazor-site-url/img/DefaultLogo.jpg - - - 400 0 - 112.8046ms
2023-03-09 16:45:27.366 +00:00 [INF] Received HTTP/1.1 response 400.
2023-03-09 16:45:27.366 +00:00 [INF] Executed endpoint '/{**catch-all}'
2023-03-09 16:45:27.372 +00:00 [INF] Request finished HTTP/1.1 GET https://blazor-site-url/img/DefaultLogo.jpg - - - 400 0 - 152.5473ms
2023-03-09 16:45:27.374 +00:00 [INF] Received HTTP/1.1 response 400.
2023-03-09 16:45:27.375 +00:00 [INF] Executed endpoint '/{**catch-all}'
2023-03-09 16:45:27.380 +00:00 [INF] Request finished HTTP/1.1 GET https://blazor-site-url/img/DefaultLogo.jpg - - - 400 0 - 189.8787ms
2023-03-09 16:45:27.381 +00:00 [INF] Received HTTP/1.1 response 400.

Any ideas??

Problems when deploying the legacy app as a subsite

Hello!
loving this package so far, i'm trying to rewrite a legacy webforms app using blazor server.
However i'm having some problems when deploying the apps.
The legacy app is deployed as a subsite, so for example: https://legacyapp.domain.com/subsite
in the appsettings.json of the blazor app i've correctly set the urls using https://legacyapp.domain.com/subsite as destinationPrefix.
In this situation the proxy doesn't seem to work, i get correctly redirected to https://legacyapp.domain.com/subsite when opening the blazor app, but after authenticating i'm not redirected back to the blazor app, whereas while debugging locally everything works as expected.
I'm guessing is has to do with the legacy app being deployed as a subsite but i'm actually not sure.
Where i get redirected for authentication the return url is https://legacyapp.domain.com/subsite/Account/Login?redirecturl=~/ which obviously cannot work... i tried manually setting the redirect url to the url of the deployed blazor app but that doesn't work too, after auth i'm redirected to the legacy app.
How should i approach this situation?
Many thanks

Long HTTP requests causes YARP to Timeout

Hello!

I am currently testing this library to allow an incremental migration of a BIG Webforms application (>160 pages) to Blazor server.

First tests seem to run apparently fine however some pages take a very good while to load in the web forms app (we're talking about 2-5 minutes just to load) which causes YARP to fail miserably.

Here is a Pastebin for all intents and purposes: https://pastebin.com/cHHkbv9m

Now the question is, how should I go about appropriately handling the timeout value using this Library?

Security bug

I think I've found a nasty security-related bug. What's the best way to disclose this without publicly posting it?

Wrong routing when component implements class based on ComponentBase

Hello!
I'm trying to rewrite a legacy webforms app using Blazor server.
However, I'm having some problems with proxy routing.

Let's imagine ComponentBase class implementation such as this one:

public class CancellableComponent : ComponentBase, IDisposable
{
	internal CancellationTokenSource _cts = new();

	public void Dispose()
	{
		_cts.Cancel();
		_cts.Dispose();
	}
}

and the component that is implementing it

@page "/Settings"
@implements CancellableComponent
...

Then routing is strange, when I hit URL (for example https://localhost:5001/Settings) directly, it is not routed to Blazor page, but to the original webforms page. But when I click on its tab in the menu (Blazor part) it is routed correctly. Of course, when I remove @implements CancellableComponent from Blazor page, routing is correct in any circumstances.

How should I approach this situation, is there any chance of implementing my custom component base and having correct routing?
Many thanks

Contributions/suggestions?

Enjoying the stream - many thanks!

Wanted to know if you'd like contributions and suggestions or if you want to do it all on-stream

Bug: Unexpected msgpack code 13 (positive fixint) encountered

Running with Blazor Server on .NET 6, if a user is not logged on we get this exception in the Blazor app's log:

[17:23:30 ERR] Failed to deserialize ReCode.Cocoon.Proxy.Authentication.MessagePrincipal value.
MessagePack.MessagePackSerializationException: Failed to deserialize ReCode.Cocoon.Proxy.Authentication.MessagePrincipal value.
 ---> MessagePack.MessagePackSerializationException: Unexpected msgpack code 13 (positive fixint) encountered.
   at MessagePack.MessagePackReader.ThrowInvalidCode(Byte code)
   at MessagePack.MessagePackReader.ReadArrayHeader()
   at MessagePack.Formatters.ReCode_Cocoon_Proxy_Authentication_MessagePrincipalFormatter1.Deserialize(MessagePackReader& reader, MessagePackSerializerOptions options)
   at MessagePack.MessagePackSerializer.Deserialize[T](MessagePackReader& reader, MessagePackSerializerOptions options)
   --- End of inner exception stack trace ---
   at MessagePack.MessagePackSerializer.Deserialize[T](MessagePackReader& reader, MessagePackSerializerOptions options)
   at MessagePack.MessagePackSerializer.DeserializeFromSequenceAndRewindStreamIfPossible[T](Stream streamToRewind, MessagePackSerializerOptions options, ReadOnlySequence`1 sequence, CancellationToken cancellationToken)
   at MessagePack.MessagePackSerializer.DeserializeAsync[T](Stream stream, MessagePackSerializerOptions options, CancellationToken cancellationToken)
   at ReCode.Cocoon.Proxy.Authentication.CocoonAuthenticationClient.DeserializePrincipal(Stream stream)
   at ReCode.Cocoon.Proxy.Authentication.CocoonAuthenticationClient.AuthenticateAsync(HttpRequest request)
[17:23:30 INF] Cocoon was not authenticated. Failure message: Failed to deserialize ReCode.Cocoon.Proxy.Authentication.MessagePrincipal value.

Looking at the code in CocoonAuthenticationClient,cs, it logs the response and status code, which we see in the Blazor log just before the exception:

[17:23:29 INF] Start processing HTTP request GET http://localhost:9343/facadeauth
[17:23:29 INF] Sending HTTP request GET http://localhost:9343/facadeauth
[17:23:30 INF] Received HTTP response headers after 474.8694ms - 200
[17:23:30 INF] End processing HTTP request after 478.5473ms - 200

Note the 200 response code.

Looking at AuthApiHandler.cs in Cocoon.Legacy it should return a 401 if not logged in, however that does not seem to be happening.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.