Skip to content
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

Double requests #25

Open
newdeal30 opened this issue Jun 9, 2020 · 3 comments
Open

Double requests #25

newdeal30 opened this issue Jun 9, 2020 · 3 comments

Comments

@newdeal30
Copy link

Hi MisterMagoo,

Thanks for your package.
I know you stopped development on the package, but maybe you can answer me a question.
My server-side blazor pwa project uses identity. When i login to the page, the POST requests get send 2 times.
When i look at the developer options from the browser i see, that 1 time the POST is send from the form, and one time from ServiceWorker.
Do you know that problem?

Thanks and regards
Michael

@SQL-MisterMagoo
Copy link
Owner

Are you sure it is being sent over the wire twice?
Here is a sample from the network tab of one of mine

image

You will see lots of cached responses (5th column - size - is greyed out) and two actual network requests (about 612 b each).

On those two requests that made it to the network, you will see two entries in the list as the page requests the network data and the service worker intercepts and performs the actual call.

If you are seeing two actual network requests to the same resource, you might need to modify the service worker to just pass all requests to your identity provider without interruption.

@newdeal30
Copy link
Author

Yes, it is send over the network twice. I get two requests to my controller. One from ServiceWorker.js, and one from the website itself. If i deregister the serviceworker and remove the includes from _Host.cshtml, things are working like they should.
Its also not only on the identity login. Same behavior when doing a GET/POST call from my swagger page.
Very strange...

PS: I am using ServerSide Blazor
vs

@newdeal30
Copy link
Author

I have made a sample project, to see the behavoir. (https://github.com/newdeal30/BlazorPWAApp3)
To reproduce:
Set a breakpoint in TestController/Get
Navigate to https://localhost:5001/swagger
Try the method.
It should hit 2 times.

Thanks and regards
Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants