# NGINX Proxy from New Domain to Old Domain

**URL:** <https://community.graylog.org/t/nginx-proxy-from-new-domain-to-old-domain/19488>\
**Category:** Graylog Central (peer support)\
**Created:** [April 15, 2021, 3:21pm UTC](https://community.graylog.org/t/nginx-proxy-from-new-domain-to-old-domain/19488 "2021-04-15T15:21:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SnazzyBootMan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/snazzybootman/32/8392_2.png) [@SnazzyBootMan](https://community.graylog.org/u/SnazzyBootMan)\
**Post date:** [April 15, 2021, 3:21pm UTC](https://community.graylog.org/t/nginx-proxy-from-new-domain-to-old-domain/19488/1 "2021-04-15T15:21:48Z")

</div>

I am currently running Graylog 3.2.6 behind an NGINX proxy and everything seems fine using this configuration:

```
location / {
      proxy_set_header Host $http_host;
      proxy_set_header X-Forwarded-Host $host;
      proxy_set_header X-Forwarded-Server $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Graylog-Server-URL https://$server_name/;
      proxy_pass http://127.0.0.1:9000;
}

```

I now have a new domain and I would like to proxy from the new domain to the old domain using another NGINX proxy. I seem to be having problems getting this to work and wondered if any one had tried this before?

I would be using a subfolder as the location on the new domain as I need to redirect the proxy to a few other web applications:

New domain is [https://my.newdomain.uk/graylog](https://my.newdomain.uk/graylog)

```
location /graylog {
  proxy_ssl_server_name on;
  proxy_ssl_trusted_certificate /etc/nginx/conf.d/trusted_ca_cert.pem;
  proxy_set_header Host \$http_host;
  proxy_set_header X-Forwarded-Host \$host;
  proxy_set_header X-Forwarded-Server \$host;
  proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
  proxy_set_header X-Graylog-Server-URL https://\$server_name/graylog/;
  rewrite ^/graylog/(.*)$ /\$1 break;
  proxy_pass https://graylog.olddomain.uk/;
}

```

Config taken from the Graylog docs at: [Web interface — Graylog 3.2.0 documentation](https://docs.graylog.org/en/3.2/pages/configuration/web_interface.html#nginx)

Looking at the developer network tools its looks like I am getting through to “[graylog.olddomain.uk](http://graylog.olddomain.uk)” for some of the calls but some are failing like config.js,

```
graylog	200	document	Other	2.1 kB	38 ms	
config.js	(failed)	script	graylog	0 B	26.67 s	
vendor.5452e7a2fdfb6282da0a.js	(failed)	script	graylog	0 B	26.97 s	
polyfill.8db32af0c31b8447f8a4.js	200	script	graylog	(memory cache)	0 ms	
builtins.8db32af0c31b8447f8a4.js	200	script	graylog	(memory cache)	0 ms	
plugin.org.graylog.plugins.threatintel.ThreatIntelPlugin.65246bb8027ae212c591.js	(failed)	script	graylog	0 B	26.97 s	
plugin.org.graylog.plugins.collector.CollectorPlugin.8abec7f8843fccf91256.js	(failed)	script	graylog	0 B	45.71 s	
plugin.org.graylog.integrations.IntegrationsPlugin.84791d9e764ff1198f4a.js	(failed)	script	graylog	0 B	45.98 s	
plugin.org.graylog.aws.AWSPlugin.98d75e309aea282eb4fb.js	200	script	graylog	(memory cache)	0 ms	
plugin.com.sportalliance.graylog.plugins.slacknoti…n.SlackNotificationPlugin.ee93dacee86e841efd4c.js	200	script	graylog	(memory cache)	0 ms	
app.8db32af0c31b8447f8a4.js	(failed)	script	graylog	0 B	45.99 s	Scriptpolyfill.8db32af0c31b8447f8a4.js	200	script	graylog	(disk cache)	3 ms	
builtins.8db32af0c31b8447f8a4.js	200	script	graylog	(disk cache)	37 ms	
plugin.org.graylog.aws.AWSPlugin.98d75e309aea282eb4fb.js	200	script	graylog	(disk cache)	92 ms	
plugin.com.sportalliance.graylog.plugins.slacknoti…n.SlackNotificationPlugin.ee93dacee86e841efd4c.js	200	script	graylog	(disk cache)	3 ms	
favicon.png	(failed) Other	0 B	29.49 s

```

Looking at the config.js initiator tab in dev tools:

```
    https://my.newdomain.uk/graylog
    https://graylog.olddomain.uk/config.js
```

---

<div class="post-metadata">

**Author:** ![gsmith](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/gsmith/32/1222_2.png) [@gsmith](https://community.graylog.org/u/gsmith)\
**Post date:** [April 15, 2021, 9:32pm UTC](https://community.graylog.org/t/nginx-proxy-from-new-domain-to-old-domain/19488/2 "2021-04-15T21:32:52Z")

</div>

Hello,  
I have not configured Nginx to be used between to domains, but I do have a question on the configuration as shown below.

> [@SnazzyBootMan](#):
>
> ` proxy_pass https://graylog.olddomain.uk/;`

Was this a typo? or you not using port 9000 in your proxy config?

---

<div class="post-metadata">

**Author:** ![SnazzyBootMan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/snazzybootman/32/8392_2.png) [@SnazzyBootMan](https://community.graylog.org/u/SnazzyBootMan)\
**Post date:** [April 16, 2021, 6:36am UTC](https://community.graylog.org/t/nginx-proxy-from-new-domain-to-old-domain/19488/3 "2021-04-16T06:36:38Z")

</div>

No this is not a typo, two NGINX proxies are in place. So the config relating to port 9000 is in the proxy currently in place for the old domain (see location block one above).

---

<div class="post-metadata">

**Author:** ![SnazzyBootMan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/snazzybootman/32/8392_2.png) [@SnazzyBootMan](https://community.graylog.org/u/SnazzyBootMan)\
**Post date:** [April 21, 2021, 3:33pm UTC](https://community.graylog.org/t/nginx-proxy-from-new-domain-to-old-domain/19488/4 "2021-04-21T15:33:23Z")

</div>

So after a lot of attempts at getting a sub path working I had to give up and set this up on root. This required splitting all the configurations up into separate sites.

```auto
location / {
  proxy_ssl_server_name on;
  proxy_ssl_trusted_certificate /etc/nginx/conf.d/trusted_ca_cert.pem;
  proxy_set_header Host $http_host;
  proxy_set_header X-Forwarded-Host $host;
  proxy_set_header X-Forwarded-Server $host;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Graylog-Server-URL https://$server_name;
  proxy_pass https://graylog.olddomain.uk/;
  proxy_redirect off;
  sub_filter_types *;
  sub_filter_once off;
  sub_filter_last_modified on;
  sub_filter "https://\$proxy_host" "$scheme://$host";
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/3X/c/7/c7c09c6b5099570133d6502b83f50ba4430de5b6.png) [@system](https://community.graylog.org/u/system)\
**Post date:** [May 5, 2021, 3:33pm UTC](https://community.graylog.org/t/nginx-proxy-from-new-domain-to-old-domain/19488/5 "2021-05-05T15:33:29Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
