Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a67b071

Browse files
DRSDavidSoftunknwon
andauthored
FAQ: Add IIS reverse proxy instructions (#253)
Co-authored-by: ᴜɴᴋɴᴡᴏɴ <u@gogs.io>
1 parent da09baa commit a67b071

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

‎en-US/intro/faqs.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,54 @@ git.example.com {
143143
}
144144
```
145145

146+
#### How do I use IIS with Reverse Proxy?
147+
148+
Create a new website in IIS, and use the following `web.config` file:
149+
150+
- Modifiy `git.crystalnetwork.us` to your actual domain name
151+
- If you don't use or need HTTPS to be handled by IIS, remove the entire `<rule name="RedirectToHttps" ...>` section
152+
153+
```xml
154+
<?xml version="1.0" encoding="UTF-8"?>
155+
<configuration>
156+
<system.webServer>
157+
<rewrite>
158+
<rules>
159+
<rule name="RedirectToHttps" stopProcessing="true">
160+
<match url=".*" />
161+
<conditions>
162+
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
163+
</conditions>
164+
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
165+
</rule>
166+
<rule name="ReverseProxyInboundRule" stopProcessing="true">
167+
<match url="(.*)" />
168+
<action type="Rewrite" url="http://localhost:3000/{R:1}" />
169+
</rule>
170+
</rules>
171+
<outboundRules>
172+
<rule name="ReverseProxyOutboundRule" preCondition="ResponseIsHtml">
173+
<match filterByTags="A, Form, Img" pattern="^http(s)?://localhost:3000/(.*)" />
174+
<action type="Rewrite" value="http{R:1}://git.crystalnetwork.us/{R:2}" />
175+
</rule>
176+
<preConditions>
177+
<preCondition name="ResponseIsHtml">
178+
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
179+
</preCondition>
180+
</preConditions>
181+
</outboundRules>
182+
</rewrite>
183+
</system.webServer>
184+
</configuration>
185+
```
186+
187+
Then, change the following configuration options in `custom/conf/app.ini`:
188+
189+
```
190+
[server]
191+
EXTERNAL_URL = https://git.example.com/
192+
```
193+
146194
#### How do I set up HTTPS?
147195

148196
Change the following configuration options in `custom/conf/app.ini` in the section that looks like this sample:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /