skip to Main Content

Ok I created my first web application with Flutter, setup SSL and have a domain with two flavours.

http://example.com and

https://example.com setup on IIS.

How can I redirect http to https with Flutter?

I could create Url rewrite server side but I would love to do via Flutter.

Is there such a configuration available?

2

Answers


  1. Chosen as BEST ANSWER

    Since the server is IIS I a added the following web.config to handle the https redirection by using the Rewrite Module

    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <rule name="HTTPS force" enabled="true" stopProcessing="true">
                        <match url="(.*)" />
                        <conditions>
                            <add input="{HTTPS}" pattern="^OFF$" />
                        </conditions>
                        <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>
    

  2. The SSL redirection should be setup on your DNS and Hosting service rather than in Flutter web implementation or any Web implementation for that matter. Please check with your DNS provider and Hosting provider on SSL certificate installation and enabling SSL redirection.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search