How do I add SSL to nginx in an ACI conntainer?

Brian Goff 0 Reputation points
2025-02-06T18:44:00.1533333+00:00

I have an ACI hosting an angular app with nginx that runs fine on port 80. However, browsers complain with the "strict-origin-when-cross-origin" cors error. I've added headers with 'Access-Control-Allow-Origin', etc. but the error persists and the site is blocked. I then am trying to add SSL to nginx. I've followed guidance to update the nginx conf, copied the crt and key files to the nginx, but the ACI container then fails to start. I may be missing a step or there's a gap in my understanding. Any advice or assistance is appreciated.

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
725 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Akshay kumar Mandha 2,435 Reputation points Microsoft Vendor
    2025-02-07T16:28:59.18+00:00

    Hi Brian Goff,
    Thank you for your patience while reviewing the query.
    I have tried it on my side, and it is working as expected. Could you please make the changes to the hosts file as per the following path on your machine: C:\Windows\System32\drivers\etc

    User's image

    Click on the hosts file to edit it and add the following at the end of the line: # Custom DNS Name <your IP> mydomain.local For example: 127.0.0.1 mydomain.local.

    After adding it, please check if the DNS is working by running the following command: ping <your DNS name>, For example, ping mydomain.local. Image for you reference User's image

    Once verified, proceed to build the image and run the container. You should be able to browse with HTTPS. I have tested this locally by building and running the container with SSL, and browsing via HTTPS is working fine. Please see the image below for your reference.

    User's image

    If you're seeing a warning message in the address bar, it's because self-signed certificates aren't trusted by browsers like Chrome or Edge. They lack a recognized Certificate Authority (CA) behind them, meaning users will see security warnings when visiting your website, even though the certificate still encrypts data

    Please refer to the image below for your reference and documentation How Exactly Do Self-Signed Certificates Differ from CA-Signed Certificates? User's image

    Could you please try and let me know if you encounter any issues? Please feel free to ping me in the comments, and I'll be happy to assist you as needed

    If you found this information helpful and my inputs, please click an accepting the answer and "Upvote" on my post for other community members referenceUser's image


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.