# How to add a proxy rule in the ood\_portal.yml file?

**URL:** <https://discourse.openondemand.org/t/how-to-add-a-proxy-rule-in-the-ood-portal-yml-file/488>\
**Category:** Get Help\
**Created:** [September 13, 2019, 5:38am UTC](https://discourse.openondemand.org/t/how-to-add-a-proxy-rule-in-the-ood-portal-yml-file/488 "2019-09-13T05:38:06Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [September 16, 2019, 2:50pm UTC](https://discourse.openondemand.org/t/how-to-add-a-proxy-rule-in-the-ood-portal-yml-file/488/2 "2019-09-16T14:50:57Z")

</div>

I don’t think you can by editing the confg yml. We just don’t allow for arbitrary redirect rules, though maybe we should?

Most folks modify the resulting `/opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf` when they need to do something like this. But this comes at a price, those edits will not be preserved next time you reconfigure using the `ood-portal-generator`. So you’d have to add them back every time.

So, if you really need to do this, I’d suggest hacking the template it’s created from.

This is the file to modify: `/opt/ood/ood-portal-generator/templates/ood-portal.conf.erb`. **Please make a back up copy before you make any modifications**. If you get into trouble, just start over from ood-portal.conf.erb.backup (or whatever you name the backup file).

It’s a ruby ERB template file, but you can just add hard coded rules. Here’s the section I pulled where we’re redirecting / to /pun/sys/dashboard. Just add your items after it like so,

```ruby
  <%- if @root_uri -%>
  # Redirect root URI to specified URI
  #
  # <%= @ssl ? "https" : "http" %>://<%= @servername || "localhost" %>:<%= @port %>/
  # #=> <%= @ssl ? "https" : "http" %>://<%= @servername || "localhost" %>:<%= @port %><%= @root_uri %>
  #
  RedirectMatch ^/$ "<%= @root_uri %>"
  <%- end -%>

  # Here are my additional redirects modified in the template
  RedirectMatch ^/blah-blah-blah$ "/yadda-yadda-yadda"

```

I tell if you want a [redirect or a rewrite](https://httpd.apache.org/docs/2.4/rewrite/remapping.html). This explanation was for a redirect, but it would be the same for rewrite like this if I wanted to get rid of the /pun/sys bit of the url for my super cool app.

```bash
  # Here are my additional redirects & rewrites modified in the template
  RedirectMatch ^/blah-blah-blah$ "/yadda-yadda-yadda"
  RewriteRule ^/pun/sys/super-cool-app$ "/super-cool-app"

```

---

_[View the full topic](https://discourse.openondemand.org/t/how-to-add-a-proxy-rule-in-the-ood-portal-yml-file/488)._
