# Reverse Proxy on Separate Host?

**URL:** https://discourse.openondemand.org/t/reverse-proxy-on-separate-host/1499
**Category:** Get Help
**Created:** [May 24, 2021, 8:29pm UTC](https://discourse.openondemand.org/t/reverse-proxy-on-separate-host/1499 "2021-05-24T20:29:12Z")
**Posts on this page:** 1
**Showing post:** 15

<div class="post-metadata">

### Author: ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)
#### Post date: [October 8, 2021, 5:25pm UTC](https://discourse.openondemand.org/t/reverse-proxy-on-separate-host/1499/15 "2021-10-08T17:25:29Z")

</div>

Hi, I think I may have something, but I think we’re breaking new ground here. Which is to say, I don’t believe anyone’s ever done this.

(1) You want to set the host as your intermediary. This means every `connection.yml` will have your intermediary proxy as the host.

```yaml
set_host: "host=$(echo my.intermediary.proxy)"

```

You probably want to set this for the entire cluster instead of in every submit.yml. Here are docs for the same.  
[https://osc.github.io/ood-documentation/latest/reference/files/submit-yml-erb.html#setting-batch-connect-options-globally](https://osc.github.io/ood-documentation/latest/reference/files/submit-yml-erb.html#setting-batch-connect-options-globally)

(2) Then you’ll need to pass back the real host through `conn_params`. Here’s how that works. You should also set these to be cluster wide (as a pose to setting it for every single app)

> [@How does conn\_params work?](https://discourse.openondemand.org/t/how-does-conn-params-work/1711):
>
> I’m trying to sort out an issue with rstudio-server 1.4 authentication, which I posted about here: [RStudio when launched without Singularity is having strange troubles with authentication - #53 by griznog](https://discourse.openondemand.org/t/rstudio-when-launched-without-singularity-is-having-strange-troubles-with-authentication/1213/53) but in troubleshooting that I realized conn\_params isn’t working as I’d expect it to. What I expect is that if I set in the app config # submit.yml.erb conn\_params: - bubba then in template/before.sh.erb I add export bubba=BUBBAWASHERE that I can then use in view.html.erb \<input type="hi…

(3) Now at this point, your apps will know all the information they need, you need to use them in the form. I’d suggest starting with an app like Jupyter instead of desktop, just to defer the whole noVNC situation, because that may need additional stuff that I don’t have offhand.

Here’s a view.html.erb I took from our Rstudio (changing rnode to node). You see the URL we’re redirecting to has `host` which you’ve set as a static string in #1 and `the_real_host` you’ve configured in #2.

**I believe you’ll have to always use _/node_ as a post to _/rnode_. Our proxy will remove /rnode/host/port portions of the URL when sending to rnode (because it’s relative). You’ll need to keep these intact so your intermediary can then determine what to do/remove.**

```html
<form action="/node/<%= host %>/<%= the_real_host %>/<%= port %>/auth-do-sign-in" method="post" target="_blank">
  <input type="hidden" name="username" value="<%= ENV["USER"] %>">
  <input type="hidden" name="password" value="<%= password %>">
  <input type="hidden" name="staySignedIn" value="1">
  <input type="hidden" name="appUri" value="">
  <button class="btn btn-primary" type="submit">
    <i class="fa fa-registered"></i> Connect to RStudio Server
  </button>
</form>

```

(4) At this point we’re talking to your intermediary, we’re proxying to it. Now comes the hard bit because you likely have to modify the URL to fit what the app is expecting and do the actual proxying. I don’t believe you can just use another OOD installation as the URL has an extra host in it so it may throw off our parsing expectations.

---

_[View the full topic](https://discourse.openondemand.org/t/reverse-proxy-on-separate-host/1499)._
