Post

ENABLE HTTPS ON WINDOWS FOR ODOO ERP

ENABLE HTTPS ON WINDOWS FOR ODOO ERP

Securing Your Odoo ERP: Step-by-Step Guide to Enabling HTTPS with IIS on Windows

Odoo is an open-source business management software suite that includes a wide range of applications and modules for various business needs. It is designed to help organizations manage their operations more efficiently and effectively.

Odoo primarily recommends using Linux as the preferred operating system for installation, although there may be unusual cases where specific requirements necessitate its installation on a Windows OS. In this setup, I am utilizing Windows’ built-in web server, IIS, as the proxy server for Odoo.

Installation of IIS is not discussed in this guide. If you are unfamiliar with the process, please refer to the YouTube video provided below. How to Setup or Configure IIS.

Install below IIS dependencies

Please download and install following IIS dependencies from Microsoft website.

Enable Proxy

  • Open IIS Management console » application request routing image Application request routing

  • Open proxy settings image Proxy Settings

  • Enable Proxy image Enable Proxy

Add Reverse proxy rules

Open URL Rewrite. This icon is present at the level or each site and web-application you have in the server, and will allow you to configure re-write rules that will apply from that level downwards.

image

Setup a Reverse Proxy rule using the Wizard.

Open the IIS Manager Console and click on the Default Web Site from the tree view on the left. Select the URL Rewrite Icon from the middle pane, and then double click it to load the URL Rewrite interface.

Chose the ‘Add Rule’ action from the right pane of the management console, and the select the ‘Reverse Proxy Rule’ from the ‘Inbound and Outbound Rules’ category.

image

Now we can proceed to fill in the routing information based on the diagram above in the Wizard window that is provided to us.

Please make sure odoo is accessible from the same server http://localhost:8069 or change the below as per your odoo URL.

You can find further information regarding the redirection from HTTP to HTTPS in the article below. Ensure that you prioritize this rule by placing it as the initial one. After creating the redirect rule, use the “Move up” arrow to position it correctly

Redirect from HTTP to HTTPS using the IIS URL Rewrite module.

My web.config file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
	<system.webServer>
		<rewrite>
			<rules>
				<clear />
				<rule name="ERP_http_https" patternSyntax="Wildcard" stopProcessing="true">
					<match url="*" />
					<conditions logicalGrouping="MatchAny" trackAllCaptures="false">
						<add input="{HTTPS}" pattern="off" />
					</conditions>
					<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Temporary" />
				</rule>
				<rule name="ReverseProxyInboundRulel" stopProcessing="true">
					<match url="(.*)" />
					<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
					<action type="Rewrite" url="http://127.0.0.1:8069/{R:1}" />
				</rule>
			</rules>
			<outboundRules>
				<rule name="ReverseProxyOutboundRulel" preCondition="ResponseIsHtml1">
					<match filterByTags="A, Form, Img" pattern="http(s)?://127.0.0.1:8069/(.*)" />
					<action type="Rewrite" value="http{R:1}://myserver.com/{R:2}" />
				</rule>
				<preConditions>
					<preCondition name="ResponseIsHtml1">
						<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
					</preCondition>
				</preConditions>
			</outboundRules>
		</rewrite>
		<httpRedirect enabled="false" destination="https://myserver.com" exactDestination="false" childOnly="true" />
	</system.webServer>
</configuration>

image

This post is licensed under CC BY 4.0 by the author.