Open Closed

Error message "https for all urls required" from Angular website #5676


User avatar
2
vu.dh@veek.vn created

Provide us with the following info:

  • ABP Framework version: v7.3.2

  • UI Type: Angular

  • Database System: MongoDB

  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

  • Exception message and full stack trace: "https for all urls required. Also for urls received by discovery. Every url in discovery document has to start with the issuer url.Also see property strictDiscoveryDocumentValidation."

  • Steps to reproduce the issue:

I am using nginx to host api, authentication and angular within https but when I go to the angular website, I am getting the error message: https for all urls required. Also for urls received by discovery. Every url in discovery document has to start with the issuer url.Also see property strictDiscoveryDocumentValidation.
image.png

However, when I go to url https://xxx.well-known/openid-configuration some endpoints are show with http. My expectation is they should https.
image.png

How do I fix my issue?


8 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Member

    Hello vu.dh@veek.vn,

    Please add this block of code to **HttpApiHostModule.cs in public override void OnApplicationInitialization(ApplicationInitializationContext context)

    app.Use((ctx, next) =>
        {
            ctx.Request.Scheme = "https";
            return next();
        });
    

    let me know if this helps you.

    Thanks,
    Anjali

  • User Avatar
    0
    vu.dh@veek.vn created

    Hello vu.dh@veek.vn,

    Please add this block of code to **HttpApiHostModule.cs in public override void OnApplicationInitialization(ApplicationInitializationContext context)

    app.Use((ctx, next) => 
        { 
            ctx.Request.Scheme = "https"; 
            return next(); 
        }); 
    

    let me know if this helps you.

    Thanks,
    Anjali

    Hi Anjali,
    I did it but the problem is still existing.

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Member

    Hello vu.dh@veek.vn,

    Can you please add the previous code in **AuthServerModule.cs file and check again?

    Please do let me know if anything else is needed.

    Thanks,
    Anjali

  • User Avatar
    0
    vu.dh@veek.vn created

    AuthServerModule

    I did it but the issue is still existing.

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Member

    Hello vu.dh@veek.vn,

    Please try this,

    app.Use((ctx, next) =>
    
            {
    
                ctx.Request.Scheme = "https";
    
                return next(ctx);
    
            });
    

    This code needs to be added in " public override void OnApplicationInitialization(ApplicationInitializationContext context) " in this file - **AuthServerModule.cs

    Please do let me know if this solution works.

    Thanks,
    Anjali

  • User Avatar
    1
    vu.dh@veek.vn created

    Hello vu.dh@veek.vn,

    Please try this,

    app.Use((ctx, next) => 
     
            { 
     
                ctx.Request.Scheme = "https"; 
     
                return next(ctx); 
     
            }); 
    

    This code needs to be added in " public override void OnApplicationInitialization(ApplicationInitializationContext context) " in this file - **AuthServerModule.cs

    Please do let me know if this solution works.

    Thanks,
    Anjali

    The issue relates to Nginx configure, I fixed it, thanks for your support.

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Member

    Hello vu.dh@veek.vn,

    Hope you doing well.

    Can we close this ticket if your query is resolved? Please confirm.

    Awaiting for your valuable response.

    Thank You,
    Anjali

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Member

    Hello vu.dh@veek.vn,

    Closing the ticket as mentioned above issue is resolved.

    Thank you,
    Anjali

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on April 11, 2025, 10:10