Server Fault Asked by meds on November 10, 2021
I have a Jenkins installation which is accessible at localhost:8080
or if accessing externally as website via IPaddress:8080
.
I’d like to access the website with something like IPaddress/jenkins
instead and have IIS know how to redirect to localhost:8080
internally when accessed like that.
This is my web.config file:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(jenkins.*)" />
<action type="Rewrite" url="http://localhost:8080/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Unfortunately, after visiting IPaddress/jenkins
I get an error 404.
You should take a look at installing the IIS Rewrite Module https://www.iis.net/downloads/microsoft/url-rewrite This is designed to accept inbound URLs that you want to modify before processing. eg, if you need to redirect to a different server, page or port.
Useful to use a UI if you aren't able to modify the web.config (or you don't want to, eg, when its from a 3rd party supplier)
Answered by simon coleman on November 10, 2021
Maybe somebody need this answer. It helped me.
Before turning our attention to IIS though, we need to tell Jenkins about our prefix (subdirectory). To do this, open
C:Program Files (x86)Jenkinsjenkins.xml
and add--prefix=/jenkins
to the entry.
Answered by Andrey on November 10, 2021
A few things:
If Step 2 has been completed: The rewrite rule currently would rewrite http://ip/jenkins/mypage.jsp
to http://ip:8080/jenkins/mypage.jsp
. If the intent is to rewrite http://ip/jenkins/mypage.jsp
to http://ip:8080/mypage.jsp
then I would recommend the match URL to be more like the following instead:
^jenkins(/.*)?$
NOTE If #3 applies, you may need an outbound rule to fix a, img, script elements as well in this scenario.
Answered by milope on November 10, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP