@tidusjar
Sup buddy! Thought I'd help out a bit. Here are the rewrite rules for MS IIS (It's possible that I'm the ONLY one running IIS, but that makes me special):
This works for both V2 and V3
https://github.com/seanvree/IIS/blob/master/ombi.web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<remove value="index.html" />
</files>
</defaultDocument>
<rewrite>
<rules>
<clear />
<rule name="ReverseProxyInboundOMBI" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://localhost:5000/OMBI/{R:1}" />
<serverVariables>
<set name="host" value="$host" />
<set name="HTTP_X_FORWARDED_HOST" value="$server_name" />
<set name="HTTP_X_REAL_IP" value="$remote_addr" />
<set name="HTTP_X_FORWARDED_FOR" value="$proxy_add_x_forwarded_for" />
<set name="HTTP_X_FORWARDED_PROTO" value="$scheme" />
<set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
</serverVariables>
</rule>
</rules>
<outboundRules>
<clear />
<rule name="ReverseProxyOutboundOMBI" preCondition="ResponseIsHtml1">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^http(s)?://localhost:5000/OMBI/(.*)" />
<!-- CHANGE DOMAIN BELOW -->
<action type="Rewrite" value="http{R:1}://yourdomain.com/OMBI/{R:2}" />
</rule>
</outboundRules>
</rewrite>
<security>
<authentication>
</authentication>
</security>
<urlCompression doStaticCompression="false" doDynamicCompression="false" />
</system.webServer>
</configuration>
Hey dude! Thanks, I'll add it to the wiki!
hey @tidusjar correction, the above works for v2 and PARTIALLY for v3. I'm working on it tho.
Having a hard time with this gem:
if ($http_referer ~* /ombi/) {
rewrite ^/dist/(.*) $scheme://$host/ombi/dist/$1 permanent;
I CANNOT get OMBI v3 to rewrite to /DIST. no matter what rewrite rules, server variables or preconditions I set on the webserver, it will NOT get me past the base URL and into /DIST.
Can you do something like:
<rewrite>
<rules>
<rule name="Rewrite dist to base url">
<match url="^/dist/*" />
<action type="Rewrite" url="/ombi/dist/{R:1}" />
</rule>
</rules>
</rewrite>
@tidusjar minor thing -
"^/dist/*"
isn't valid, has to be
"^/dist/(.*)"
I added that to the inbound rule which seemed to help, but I think this is an outbound rule issue.
So I THINK this is one of two things happening.
So, what I think needs to happen is a "condition" within the original reverse proxy outbound rule. This would allow for content at /ombi to be served along with anything at /ombi/dist as well. But, I'm still having issues with that. (see the screenshot below).
2 - I think there MAY be an issue with the JS aspect of the application applying the BASE URL. In the screenshot below, you'll see the webserver's URL rewrite IS working for other resources such as translations, API, etc. The inbound and outbound rules apply to everything after /OMBI. Sooooo, why not the DIST directory? .... makes no sense.
see here:
Here is my link BTW:
This is the full web.config file I've got applied right now:
<rewrite>
<rules>
<clear />
<rule name="ReverseProxyInboundombi" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true" />
<serverVariables>
<set name="HTTP_X_FORWARDED_HOST" value="$server_name" />
<set name="HTTP_X_REAL_IP" value="$remote_addr" />
<set name="HTTP_X_FORWARDED_FOR" value="$proxy_add_x_forwarded_for" />
<set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
<set name="HTTP_X_FORWARDED_PROTO" value="$scheme" />
</serverVariables>
<action type="Rewrite" url="http://localhost:5000/ombi/{R:1}" />
</rule>
</rules>
<outboundRules>
<clear />
<rule name="ReverseProxyOutboundombi" preCondition="dist" enabled="true">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^http(s)?://localhost:5000/ombi/(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
</conditions>
<action type="Rewrite" value="http{R:1}://seanvree.com/ombi/{R:2}" />
</rule>
<rule name="ReverseProxyOutboundombidist" preCondition="dist" enabled="true" stopProcessing="true">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^/dist(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
</conditions>
<action type="Rewrite" value="http{R:1}://seanvree.com/ombi/dist/{R:1}" />
</rule>
<preConditions>
<preCondition name="dist">
<add input="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" pattern="^(.*)" />
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
<rewriteMaps>
<rewriteMap name="dist">
</rewriteMap>
</rewriteMaps>
</rewrite>
Any luck with this?
Hi Jamie, I wanted to 2nd this issue with Sean. I am an IIS user as well. My setup is not as dynamic as Sean's but when I attempted his it seems to be of no luck.
Also, the last build that seemed to work for me was 3.0.2712.
Thank you for all your hard work nonetheless.
Hey guys,
I've been incredibly busy lately with stuff outside of Ombi so I have had no time to look into this.
@seanvree seems to be the expert on IIS (Knows more than me), so what he has done would already be better than what I can come up with.
All I know is that somehow we need to rewrite in incoming request to /dist/1.js
to /ombi/dist/1.js
(1 is an example, it could be any number).
@tidusjar let me ask you this.....are the ONLY files that need to be rewrote to /DIST in a number pattern? soooo 87.js, 3.js, but not blah.js?
Also, are *.js files not static?
I'm totally willing to figure this out, and I CAN figure it out, but I need to know how the back-end is serving the JS files.
So yeah it's literally /dist/{number}.js
Not sure what you mean by static, but those .js files are served dymanically at runtime, but the exist on disk in the correct location.
Humm, okay, I think I can do some wizardry here. BRB.
I think I have a good solution. Running some tests.
@tidusjar okay a bit of an update, making some progress here.
One question I wanna make very clear here Jamie - are the ONLY files that need to be re-wrote to /dist NUMBERED .JS files? So in other words, blah.js should NOT be re-wrote to /DIST but 001.js IS rewrote to /DIST?
So, here is what I'm working with right now:
The problem is that when choosing what to rewrite to DIST within IIS, it chooses via content tag/attribute, (script, css, img, etc) looks like this:
So I'm having trouble isolating the numbered .js files so that ONLY the numbered .js files are rewrote to /DIST.
So, with the settings above, these are the errors I"m getting in the browser console:
You'll see that the rewrite rules ARE working, and it is re-writing to /DIST, but it's rewriting ALL scripts to /DIST. Example from the screenshot: ombiv3/loading.css is NOT being re-wrote to DIST because it's not a script, but vendor.js is a script, so IIS rewrites it to /DIST . So does vendor.js need to re-wrote to /DIST or should that be served from base?
I still have some ideas I'm working on, but just wanted to get your take.
Thoughts?
Ok.
So Ombi will automatically server vendor.js
and main.js
in the ombiv3/dist/
directory. It will take care of everything except the /dist/1.js
.
So you should not have to worry about anything other than the numbered fils. Your rule could say rewrite everything (not worrying about the number) from /dist/
to /ombiv3/dist/
and that would also work fine, since the only think Ombi cannot rewrite is the 1.js
for example.
Does that help?
@tidusjar that helps, and so does this bottle of Jameson.
Srsly tho, yeah, that helps, still workin' it buddy.
Thanks brother.
@tidusjar dude, I'm starting to get pissed now. HA!
What is wrong with this link:
http://localhost/ombiv3/dist/vendor.css?v=2GCDoRZwuCMsB5hCBgLZvUpd336ZXIhrNwnyCorabRo
and from the WAN via SSL:
I don't get it?!
Strange, must have been something you have done:
@tidusjar Ha, I don't think it's something I've "done" rather something I haven't done.
I don't get it.
I'll take another swag at it tomo.
Welp. I'm stuck. I tested on two diff windows boxes running IIS. I can't get it to work. Looks like we are dealing with an angular issue. Have seen this before with other apps such as Grafana, Mattermost and Deluge. _MAY_ be SOL for the time being.
Two options right now
@Xenocell12 and/or @jayfinley hit me up on discord, need to have you guys test something.
Is there any update here? I was using v2, with IIS and the recent version (3x) is not working with url rewrite
@1ntroduc3 Nope. I've spent several hours on it. Tried on two diff boxes with IIS, I can't figure it out. I know it's an angular issue. I've seen a couple apps do this...Grafana, Deluge (Python).
I enlisted a dude from MS to help, and he was stuck too.
thanks @seanvree hopefully a solution will come soon.
@tidusjar ! Ombi v3.0.3020 now works with URL rewrite in IIS! Thanks for implementing your experiment. @seanvree rejoice!
I can't get this working, all I get is HTTP 500's. I've tried both v3.0.3030 and v3.0.3020.
I'm running Server 2016 (IIS 10.0).
I'm using the web.config file from https://github.com/seanvree/IIS/blob/master/ombi.web.config
@Xenocell12 what are you rewrite rules you're using?
@seanvree
This is my config for Ombi.
Please regard that it is sitting behind the default Server Essentials 2012 R2 web portal under the "Default Web Site" site.
I make the rule on the site mentioned above using URL Rewrite.
I took advantage of the prebuilt IIS.
I also never make outbound rules. Never knew how to use them lol.
<rule name="Plex Requests" enabled="true">
<match url="^plexrequests(.*)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="http://192.168.1.79:5000/{R:0}" appendQueryString="true" />
</rule>
<rule name="Ombi inbound" enabled="false" stopProcessing="false">
<match url="^plexrequests(.*)$" />
<serverVariables>
</serverVariables>
<action type="Rewrite" url="http://192.168.1.79:5000/{R:0}" />
@Xenocell12 This is working for me as well!!
BOOM! GOT IT! @Xenocell12 there's a couple things I would suggest to clean up your rules, but I'll post here in second what the final resolution is. Just doing some testing.
@tidusjar @jakemarston Here is a good IIS web.config for OMBI. Tested and works:
https://github.com/seanvree/IIS/blob/master/ombi.web.config
Note: Be sure to replace "youredomain" with your domain.
Also, I have my OMBI basepath set as "plexrequest" if you have something elese, this needs to match what you have in OMBI:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<remove value="index.html" />
</files>
</defaultDocument>
<rewrite>
<rules>
<clear />
<rule name="ReverseProxyInboundOMBI" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://localhost:3579/plexrequest/{R:1}" />
<serverVariables>
<set name="host" value="$host" />
<set name="HTTP_X_FORWARDED_HOST" value="$server_name" />
<set name="HTTP_X_REAL_IP" value="$remote_addr" />
<set name="HTTP_X_FORWARDED_FOR" value="$proxy_add_x_forwarded_for" />
<set name="HTTP_X_FORWARDED_PROTO" value="$scheme" />
<set name="HTTP_X_FORWARDED_SSL" value="on" />
</serverVariables>
<conditions trackAllCaptures="true">
</conditions>
</rule>
</rules>
<outboundRules>
<clear />
<rule name="Restore Encoding" preCondition="Restore HTTP_ACCEPT_ENCODING}" enabled="true">
<match serverVariable="HTTP_ACCEPT_ENCODING" pattern="^(.+)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true" />
<action type="Rewrite" value="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" />
</rule>
<rule name="ReverseProxyOutboundOMBI" preCondition="ResponseIsHtml1" enabled="true" stopProcessing="false">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^http(s)?://localhost:3579/plexrequest/(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{HTTP_REFERER}" pattern="/plexrequest" />
</conditions>
<action type="Rewrite" value="http{R:1}://<yourdomain>.com/plexrequest/{R:2}" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
<preCondition name="Restore HTTP_ACCEPT_ENCODING}">
<add input="{RESPONSE_CONTENT_TYPE}" pattern=".+" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
<security>
<authentication>
</authentication>
</security>
<urlCompression doStaticCompression="true" doDynamicCompression="false" />
<httpRedirect enabled="false" destination="http://yourdomain.com:3579" exactDestination="true" />
</system.webServer>
</configuration>
Should look something like this in IIS:
@seanvree Can you provide a bit of information on the differences between the configuration you provided and Xenocell12 provided?
@jakemarston
Sure,
So @Xenocell12 doesn't use any outbound rules, which I'm curious how it actually works without doing so?
A few other differences:
You def don't need all the variables mine uses, but it should capture anything/everything that OMBI throws at it. @Xenocell12 is a VERY VERY basic RP setup.
Not trying to step on anyone's toes or "one-up" anyone. I'm just bit of a IIS snob you could say.
DEF happy @tidusjar got his shit together and figured this out. LOL, jk. Jamie, thanks brotha, much appreciated.
Most helpful comment
@1ntroduc3 Nope. I've spent several hours on it. Tried on two diff boxes with IIS, I can't figure it out. I know it's an angular issue. I've seen a couple apps do this...Grafana, Deluge (Python).
I enlisted a dude from MS to help, and he was stuck too.