Skip to content

Instantly share code, notes, and snippets.

@betimd
Last active December 8, 2016 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save betimd/2e4f320f89ce8365d094a613374d6801 to your computer and use it in GitHub Desktop.
Save betimd/2e4f320f89ce8365d094a613374d6801 to your computer and use it in GitHub Desktop.
Asp.Net Core Web Config file to deploy in AWS ElastinBeanstalk that will server requests just in HTTPS (redirect HTTP to S)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout"
forwardWindowsAuthToken="false"/>
<rewrite>
<rules>
<rule name="HTTPS rewrite behind AWS Elastic Load Balancer rule" enabled="true" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{HTTP_X_FORWARDED_PROTO}" pattern="^http$" ignoreCase="false" />
</conditions>
<action type="Redirect" url="https://{SERVER_NAME}{URL}" redirectType="Found" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment