Repository navigation
Description
Current behavior 🐛
changing the applicationUrl value to use https in launchsettings (same ports) and using the provided server project doing the same there, the build will instantly fail with the message that it failed to find the server:
Expected behavior 🎯
as dotnet runtime and most api we might want to send requests to, will require the usage of antiforgery and cors, it should be the default or even possible, to use https instead of http
How to reproduce it (as minimally and precisely as possible) 🔬
create a new uno app including wasm target, server project and for example custom auth.
start it and see the notification at the top bar.
go to the uno app launchsettings and set the http to https, same for the server project
will not longer build and fail with the shown message.
Workaround 🛠️
None! does not build when setting the url to https even while our server defines app.UseHttpsRedirection()
Renderer 🎨
- Skia
- Native
Affected platforms 📱💻🖥️
No response
Uno.Sdk version (and other relevant versions) 📦
6.1.23
IDE version 🧑💻
17.14.9
Anything else we need to know? 💬
If our apps are only able to use http, this will make the user get notifyed that the page he is surfing on, does not support https and he shall not type in any passwords etc. now, if our app would then be configured by template already to use authentication with e.g. customauth, that very first view he will get presented, IS a Login UI. See the Problem?
By that our produced app is marked as NOT trustable.
in best case those features should get build in, so for example, this is what I would suggest to be usable gathered from multiple resources you can find linked there:
public static class SecurityServiceExtensions
{
public static IServiceCollection AddSecurityServices(this IServiceCollection services, IConfiguration configuration)
{
// Etsy Authentication requires Cross-site request forgery (CSRF) protection,
// <see href="https://developers.etsy.com/documentation/essentials/authentication#requesting-an-oauth-token"/>
// so we need to add the Antiforgery service.
services.AddAntiforgery(setupAction =>
{
setupAction.Cookie.SecurePolicy = CookieSecurePolicy.Always; // Always use HTTPS
});
// Add CORS service policy as needed for wasm Multi-threaded applications
// <see href="https://github.com/dotnet/runtime/blob/main/src/mono/wasm/features.md#multi-threading"/>
// Configuration reference:
// <see href="https://substack.com/home/post/p-164745710"/>
services.AddCors(options =>
{
var AllowedHosts = configuration["AllowedHosts"]?
.ToLowerInvariant().Split(';', StringSplitOptions.RemoveEmptyEntries)
?? throw new ArgumentNullException("AllowedHosts"); ;
string[] Methods = [
HttpMethods.Get,
HttpMethods.Post,
HttpMethods.Put,
HttpMethods.Delete,
HttpMethods.Patch
];
string[] Headers = [
HeaderNames.ContentType,
HeaderNames.Cookie, // Adding Cookie header to allow cookies in CORS requests, as I want to use Cookie Authentication
HeaderNames.Authorization,
// Adding headers referring to MDN Docs
// <see href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS" />
// to avoid problems with browsers like Safari or Nightly
HeaderNames.ContentLanguage,
HeaderNames.AcceptLanguage,
HeaderNames.AcceptEncoding,
// Adding Preflight request headers from samples
// <see href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#preflighted_requests"/>
HeaderNames.Origin,
HeaderNames.UserAgent,
HeaderNames.AccessControlRequestHeaders,
HeaderNames.AccessControlRequestMethod,
HeaderNames.Host
];
options.AddPolicy("MyCorsPolicy", policy =>
{
policy.WithOrigins()
.WithMethods(Methods)
.WithHeaders(Headers)
.DisallowCredentials() // Credentials are not required for cors requests as we use cookies
.SetPreflightMaxAge(TimeSpan.FromMinutes(10));
});
});
return services;
}
public static IApplicationBuilder UseSecurityServices(this IApplicationBuilder app)
{
app.UseCookiePolicy();
app.UseAntiforgery();
app.UseCors("MyCorsPolicy");
return app;
}
}Additionally I would not see the Uno.Wasm.Bootstrap.Server src check for cors beeing defined, which could potentially cause also failing and problems, as it does set Headers, this might not allow.
Activity
jeromelaban commentedon Jul 21, 2025
Thanks for the report.
I'm not able to reproduce this error, though the app does not start properly because it's running with https:
This an unrelated error to what you're mentioning. I've seen this "Mixed content" error in an issue before but it's likely pasted as an image and the search can't find it.
With regards to what you're reporting, make sure to keep discussing your original issue, not another that would make it difficult to follow.
DevTKSS commentedon Jul 21, 2025
@jeromelaban not sure what you mean, as this issue to reproduce you can use a
dotnet new unoapp -o UnoApp1for example choose server and wasm minimal, not sure if web auth option or pwa would be needed to be included to reproduce , but beside the template provided image I did not set any images... Just modified the url and added this to a separate file loaded in the pipeline in the api🤔 I can send you the small repro project as soon as I am at home if using the described steps does still not reproduce for you 👍DevTKSS commentedon Jul 21, 2025
But I would be interested to know either way, why it is a problem to serve both via https? Why can't we?
E.g. would try to use this: https://learn.microsoft.com/de-de/aspnet/core/security/enforcing-ssl?view=aspnetcore-9.0
But this is for me not clear to understand what I reported to them already. The advice is switching often and the use http redirection seems reading the very first paragraph to cause exceptions?🤷🤔
DevTKSS commentedon Jul 21, 2025
And just FYI:
I think I did also try this without the added pipeline calls just changing the http to https to get rid of the insecure http urls and it did have this issue throwing.🤷
The devServer which is opening up locked on exception thrown is a uno provided thing which seems to be used for... Hd?🤷 Not sure but that's why I would expect that someone could help fix that
DevTKSS commentedon Jul 22, 2025
@jeromelaban found this here while searching for how Blazor does it and seems like they are using https as applicationUrl somehow 🤔
Do you see how we could get this working for uno WebAssembly - Server side?
jeromelaban commentedon Jul 22, 2025
This scenario is supported by uno at this time.
The main issue is still about #21090 (comment). Until this is fixed the app will continue crashing.
[-][WASM][Server] WebAssembly should support https by default instead of build fail[/-][+][WASM][Server] Using HTTPS fails on both the server side and app side[/+]DevTKSS commentedon Jul 22, 2025
@jeromelaban but what is that strange mixed content? the assets of the new uno app? or what? or which repro did you use? I am not sure but would not assume you used the MyManufacturerERP Repo of mine. because I am quite sure that I messed this up at the moment and possibly will need to copy paste from a new solution
jeromelaban commentedon Jul 22, 2025
@DevTKSS we'll be investigating this issue, we do not have further information to share at this time.
DevTKSS commentedon Jul 22, 2025
@jeromelaban heared you like repros? ;) Included some video material also 👍
https://technischekonstruktion-my.sharepoint.com/:u:/g/personal/info_technische-konstruktion_com/Ea3KCDG_KaNHvfhER4bnQ0gBv5oH7dHMkY5f51pq-NJs5w?e=6oI4av
jeromelaban commentedon Jul 22, 2025
Thanks. In your video, at mark 36:01, the error means that insecure connections are not allowed for the site. It needs to be enabled in the browser there when on that site (https://localhost:5001) specifically. You only enabled it for http://localhost:5000.
For the error at 27:39, this is a "networksolution" site error that has nothing to do with uno. You can skip it and continue, but in all cases, since this is a test login, it's not needed and you have to replace it for a proper login url.
DevTKSS commentedon Jul 23, 2025
@jeromelaban what about the idea about adding the auth setup we may contacting there to our server project? Like setting the sample Provider to appsettings.json and our own server login to appsettings.development.json ?
Like the API client is requesting the weather from our server also. To me that sounds be a great idea and would not just solve maybe that external non-uno provider having a problem if we just start our new created uno app with auth just as is and android and web like here would thrown this errors. Do you may see any options that could be possible and our server project template updated with this? Could ease some pain for the forst app start I think...
I mean we as users may not even targeting to use that one in debug, while if that would be set in the production ones, it would be overritten by the development settings and before running this with production settings it would be reasoned that the dev could be expected to update these settings with his own domain he than may ownes 💡
DevTKSS commentedon Jul 23, 2025
@jeromelaban and to the settings in the browser🤔 so if running the server as startup (tryed to mention it in the video) its not showing initially my app and the error caused by this missing setting, noticed yes👍 but I would miss how to set these for the https url of that while this is instantly exiting as soon as I click on the terminal link. Do you know how to set such url (manually needed maybe?) if we are NOT on this url or at least not long enough before it is instantly exiting 😅
I would now just know how to do this for a url like you shown🤔 but this case not.
May I ask which browser do you use? Mine looks different and it was difficulter to find the settings you had directly there.
I did install the chrome devtools extension some while ago before but seems like it just showing up in "insect page" and not changing something on that settings menu you had
jeromelaban commentedon Jul 23, 2025
You're asking for a server setup in the templates and we not there yet. Existing ASP.NET Core documentation can be instead instead at this time.
You have the right browser with the right options. The browser does not close when the site fails with the mixed content error, it can be changed at that time.
DevTKSS commentedon Jul 23, 2025
@jeromelaban ah okay, so while the message box is open? thanks will check 👍
DevTKSS commentedon Jul 23, 2025
@jeromelaban as you refer to the asp net core documentation and you mentioned before, that our Uno WebAssembly is very similar to blazor one 🤔 they are telling to use the
UseWebAssemblyDebugging()Middleware, which seems in decompile, to do something with that url we see in our Launchsettings the same as theirs. As I dont know what the Uno.Wasm.Bootstrapper.Server Package or Hot Reload is doing, do you see anything that would fix the https with this or is that doing just the same as uno does? And I seen that their client wasm has no launchsettings at all 🤔 no port anywhere...DevTKSS commentedon Jul 23, 2025
@jeromelaban do you can tell me, what this output means?
should I be worried about that?
DevTKSS commentedon Jul 23, 2025
@jeromelaban 🤔 so while my allow insecure contents setting is defintly set to true:



I am still getting that exception window 🤔 without clicking on Login to remark.
The cookies setting has been set to allow before, but somehow did revert itself at F5 somehow to not allow (switched it back on)
Do we need to set the advertisements to allow? (would guess no?)
on refreshing (browser suggestion) the warning is still there 🤔
just my question: DO we expect this to be this way?
and to check also, this here:
is this all as we expect it to be with the https on the wasm app added like your last caption, but server as startup, OR do we need to have then just that one with http? I dont know if it causes conflicts if both applications are having same port number matching, maybe you do know this as expert? I did not found information and also do not know if our app even looks at its launchsettings, if the server is the startproject 🤔
Or did you mean, that this issue is caused of the fact that our server from template does not have a AddCors + UseCors and same for antiforgery? Do I need to set them to not get this issues? dont know 🤔
DevTKSS commentedon Jul 23, 2025
well... 🤔 this here is unexpected to me:
I did use the uno.Bootstrapper (pane above the orange list) suggested
shift + alt + Dand after the 2nd try (first did nothing?) I got now the "Debug?" View 🤔 but... I would have expected that would be the same as the page I pressed that Keys on? 🤔as reference, this here is what I see if I again select the left tab, where I was coming from:
(Moved to issue DevTKSS/DevTKSS.MyManufacturerERP#3)
Repro will get added there most likely thats a Extensions Navigation Issue.
Will check if after the cookies enabled and 1st time (at least one progress 🎉) that it did enter successfully the debug tab, that pop up error messagebox still shows up, because at the moment I am closing this, my IDE Debugger breaks while the entering debug mode did work fine and the app seemed not to have problems besides that strange navigation discrepancy.
Maybe someone should tell the user, that he may not want to close the error box and instead ignore it? 😅
@jeromelaban would you check if we need This info to be added?
github-actions commentedon May 3, 2026
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or feature requests.