Base solution for your next web application
Open Closed

Enabling HTTPS on Angular site on IIS #3456


User avatar
0
henriksorensen created

Hi,

I am trying to add a https (port 443) binding in IIS for the Angular site but I get an error saying "An Error Has Occurred"

I have checked the following:

  1. The backend is running and I am able to see the swagger ui
  2. The frontend appsettings.json is pointing to the correct port for the backend.
  3. The CorsOrigins are pointing to the https address

If I switch the Angular site back to http (port 80) I don't get the error.

I have tried to search the forums for similar problems but with no luck.

Can you provide a quick guide to enabling HTTPS for the Angular site?

Best regards Henrik


3 Answer(s)
  • User Avatar
    0
    rvanwoezik created

    I have it working on port 44390 in Azure

    <rewrite>
          <rules>
            <rule name="Force HTTPS" enabled="true">
              <match url="(.*)" ignoreCase="false" />
              <conditions>
                <add input="{HTTPS}" pattern="off" />
              </conditions>
              <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
            </rule>
          </rules>
        </rewrite>
    

    Hope this helps

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @henriksorensen,

    We don't have a guide for this but we can try to help. When you open angular client with https, can you see if the requests are made to correct host url ? If so, host project's log file should contain detailed message for "An Error Has Occurred".

    Can you check that ? The name of log file is Logs.txt.

    Thanks.

  • User Avatar
    0
    henriksorensen created

    @rvanwoezik Thanks for your snippit for the url rewrite.

    I found that there was a problem with the routing because the server that is hosting the application is in another domain that is not trusted. This caused some redirects to fail.

    Thanks for the quick reply.