简体   繁体   中英

Azure Redirect from www to non-www in Angular and .Net Core API

I am new to Azure, but I am taking a course. However, I need to know how to set something up now.

I have an Angular 12 frontend and a .NET Core 5.0 API hosted on Azure (Linux). I want all www urls (https and non-https) to be redirected to https://example.com .

I do not have any load-sharing setup. Right now, my site is a very low-volume site. So I cannot use front door. I have tried .htaccess and web.config, and nothing seems to work.

If I type https://www.example.com , the browser will display your connection is not private. So obviously, I have something very wrong.

I do have the CNAME set to www >> example.com.

Could somebody please point me in the correct direction? I have something mucked up for sure.

Thanks, Tom

After stumbling for quite a few hours, I figured out what my problem was. Oh man, the issue was right in from of my face and I was on the wrong end of the problem. I needed to add the www.example.com in custom domains in Azure. I had example.com as an assigned domain, but I did not have the www in the assigned domains. On the bright side I did learn a lot about defining rules in .NET Core 5.0.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM