# Reverse-proxy/rewrite for Perspective with Nginx, stuck on "Authenticating..."

**URL:** <https://forum.inductiveautomation.com/t/reverse-proxy-rewrite-for-perspective-with-nginx-stuck-on-authenticating/31716>\
**Category:** Ignition Early Access\
**Tags:** perspective\
**Created:** [January 29, 2020, 2:54pm UTC](https://forum.inductiveautomation.com/t/reverse-proxy-rewrite-for-perspective-with-nginx-stuck-on-authenticating/31716 "2020-01-29T14:54:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![md.szyman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/md.szyman/32/9240_2.png) [@md.szyman](https://forum.inductiveautomation.com/u/md.szyman)\
**Post date:** [January 29, 2020, 2:54pm UTC](https://forum.inductiveautomation.com/t/reverse-proxy-rewrite-for-perspective-with-nginx-stuck-on-authenticating/31716/1 "2020-01-29T14:54:37Z")

</div>

I apologize if this is outside of the scope of this forum, but here goes.

The relevant bit of my `nginx.conf` is:

```auto
rewrite /dashboard /data/perspective/client/DashboardProject last;

location / {
    proxy_pass http://site.com:8088;
}

```

This is within the `http`, `server` block, and the server is listening on port 80.

I’ve changed the Web Server settings to look like:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/e98f9449326b3fd618afd7c553d284a93b232468.png)

Otherwise everything is default.

This _seems_ to redirect properly, Perspective _starts_ to load, but I get this and it stays stuck there.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/2/2b200769c318ec15c6e1635e260e61e079eb850d.png)

Is there something I’m missing in my configuration?

---

<div class="post-metadata">

**Author:** ![md.szyman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/md.szyman/32/9240_2.png) [@md.szyman](https://forum.inductiveautomation.com/u/md.szyman)\
**Post date:** [January 29, 2020, 2:59pm UTC](https://forum.inductiveautomation.com/t/reverse-proxy-rewrite-for-perspective-with-nginx-stuck-on-authenticating/31716/2 "2020-01-29T14:59:54Z")

</div>

Here’s some more information I was able to glean from the Chrome console. I’m getting this error:

```auto
WebSocket connection to 'ws://site.com/system/pws/DashboardProject/222da13b' failed: Error during WebSocket handshake: Unexpected response code: 400

```

The access log for nginx is showing:

```auto
 "GET /system/pws/DashboardProject/222da13b HTTP/1.1" 400 499 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"

```

I’m not seeing any gateway logs with any errors related to this.

It seems like my issue is with Nginx in this case? Or something with the interaction between proxying from Nginx to Ignition’s internal server.

---

<div class="post-metadata">

**Author:** ![md.szyman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/md.szyman/32/9240_2.png) [@md.szyman](https://forum.inductiveautomation.com/u/md.szyman)\
**Post date:** [January 29, 2020, 4:26pm UTC](https://forum.inductiveautomation.com/t/reverse-proxy-rewrite-for-perspective-with-nginx-stuck-on-authenticating/31716/3 "2020-01-29T16:26:26Z")

</div>

I’ve been trying various other permutations of this configuration, including:

```auto
location / {
    proxy_pass http://site.com:8088;
    rewrite ^/dashboard$ /data/perspective/client/DashboardProject last;
}	

```

```auto
location / {
    proxy_pass http://site.com:8088;
}

location = /dashboard {
    proxy_pass http://site.com:8088/data/perspective/client/DashboardProject;
}

```

All with the same results. Something with the `ws://` request is failing and I can’t seem to find out why it’s not being passed through to Ignition.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 29, 2020, 5:15pm UTC](https://forum.inductiveautomation.com/t/reverse-proxy-rewrite-for-perspective-with-nginx-stuck-on-authenticating/31716/4 "2020-01-29T17:15:49Z")

</div>

Looks like you might need additional rules in the proxy config to correctly pass the websocket upgrade messages?  
[http://nginx.org/en/docs/http/websocket.html](http://nginx.org/en/docs/http/websocket.html)

---

<div class="post-metadata">

**Author:** ![md.szyman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/md.szyman/32/9240_2.png) [@md.szyman](https://forum.inductiveautomation.com/u/md.szyman)\
**Post date:** [January 29, 2020, 5:30pm UTC](https://forum.inductiveautomation.com/t/reverse-proxy-rewrite-for-perspective-with-nginx-stuck-on-authenticating/31716/6 "2020-01-29T17:30:13Z")

</div>

Okay! That seemed to fix it! Thank you so much for the help.

I’ve decided to change my plan a bit from rewriting to just permanent redirecting, so here’s the final relevant section of my nginx config if anyone else runs into this:

```auto
location / {
    proxy_pass http://site.com:8088;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    rewrite ^/dashboards$ /data/perspective/client/DashboardProject permanent;
}	

```

---

<div class="post-metadata">

**Author:** ![jburt](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jburt](https://forum.inductiveautomation.com/u/jburt)\
**Post date:** [January 29, 2020, 6:23pm UTC](https://forum.inductiveautomation.com/t/reverse-proxy-rewrite-for-perspective-with-nginx-stuck-on-authenticating/31716/7 "2020-01-29T18:23:26Z")

</div>

Glad you figured it out.

We ran into the same thing using IIS rwp / url rewrite. It was fixed by adding the HTTP\_SEC\_WEBSOCKET\_EXTENSIONS to ‘Server Variables’ in the xml file. Just replying incase it’s useful in the future.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/7ecc41fc0b339a243a561fa45f088bdb78eb1825.jpeg)

---

<div class="post-metadata">

**Author:** ![mcarritt1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mcarritt1/32/4262_2.png) [@mcarritt1](https://forum.inductiveautomation.com/u/mcarritt1)\
**Post date:** [April 17, 2021, 1:20pm UTC](https://forum.inductiveautomation.com/t/reverse-proxy-rewrite-for-perspective-with-nginx-stuck-on-authenticating/31716/8 "2021-04-17T13:20:09Z")

</div>

Hi sorry to comment on an old post,

I noticed that it looks like you are redirecting with this line  
`rewrite ^/dashboards$ /data/perspective/client/DashboardProject permanent;`  
so that the url is effectively shorter

If that is right, did that work out for you? I tried to do this and eventually gave up because it was giving me problems.
