Rayrun
← Back to Discord Forum

CORS on trace viewer

Is there a way to fix cors error on showing traces from GCP bucket? any suggestion of the correct CORS configuration?

This thread is trying to answer question "Is there a way to fix cors error on showing traces from GCP bucket? Any suggestion of the correct CORS configuration?"

3 replies

Need to add an http header on the web server

'Access-Control-Allow-Origin': '*'

https://github.com/cenfun/monocart-reporter/blob/main/lib/cli.js#L70-L72

Shalom! Cors... YUK what a pain. More often cors is configured more on the server. For example on my WebApi i need to do:

builder.Services.AddCors( options => { options.AddPolicy( name: myCorsPolicy, policy => { policy.AllowAnyOrigin(); policy.AllowAnyMethod(); policy.AllowAnyHeader(); } ); } );

builder.SetupWebAppServices();
var app = builder.Build(); app.UseCors(myCorsPolicy);

This is in my startup code for my .net core app.

That is 90%, the other piece, on the client you'll probably want:

'Access-Control-Allow-Origin': '*'

While i had some stuff failing because of the .Net version i was using. ASP.Net had a bug in the pre-flight that rejected the request for any request where CORS was used. But that was a while back. You may need it or not. If all is up to date you should be fine.

If it still fails after doing all this, might need to see if your client is in the allowed origin, would assume you are, but doesn't remove the requirement to really make it all work, Cors may be configured for requests only from domains "domain_a.com, domain_b.com, someothedomain.org" with a given verb only a GET, or a given header is missing.... If the "Access-Contro...." in the client header works, and might assume it will, great, if not hope this give you what to look for to resolving it...

Just in case everything you might need but really could care less about CORS... https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

thanks, I was wondering specifically if anyone managed to define CORS on Google Cloud bucket to work with trace files.

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].