# AWX behind a reverse proxy cannot get it working!

**URL:** <https://forum.ansible.com/t/awx-behind-a-reverse-proxy-cannot-get-it-working/7665>\
**Category:** Get Help\
**Tags:** awx\
**Created:** [August 6, 2024, 8:55am UTC](https://forum.ansible.com/t/awx-behind-a-reverse-proxy-cannot-get-it-working/7665 "2024-08-06T08:55:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jarring](https://avatars.discourse-cdn.com/v4/letter/j/8491ac/32.png) [@jarring](https://forum.ansible.com/u/jarring)\
**Post date:** [August 6, 2024, 8:55am UTC](https://forum.ansible.com/t/awx-behind-a-reverse-proxy-cannot-get-it-working/7665/1 "2024-08-06T08:55:30Z")

</div>

Hello,

I have been reading and following this topic [Is AWX behind a reverse proxy actually possible?](http://forum.ansible.com/t/is-awx-behind-a-reverse-proxy-actually-possible/964) to get my nginx reverse proxy to forward my awx web ui but it seems I cannot get this working.

I’ve got an nginx acting as reverse proxy running on a machine, serving some pages just fine and awx installed in another machine following the tutorial from here : [GitHub - kurokobo/awx-on-k3s: An example implementation of AWX on single node K3s using AWX Operator, with easy-to-use simplified configuration with ownership of data and passwords.](https://github.com/kurokobo/awx-on-k3s)  
AWX web ui works as expected if not behind the proxy but when tried to have it behind the nginx proxy i’m just getting a :

`404 page not found`

My nginx config looks like :

```auto
server {
    listen 80;
    server_name awx.my.domain;

    return 301 https://$server_name$request_uri;
}

server {
        listen 443 ssl;
        server_name awx.my.domain;

        client_max_body_size 16G;

        ssl_certificate /etc/nginx/ssl/cert.crt;
        ssl_certificate_key /etc/nginx/ssl/priv-key.key;
        ssl_session_timeout 5m;                                                                                       
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;                                                                                               

    location / {
                proxy_pass https://192.168.3.2:443;
                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-Original-Forwarded-For $remote_addr;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_redirect off;
                proxy_set_header Connection "upgrade";
                proxy_set_header Upgrade $http_upgrade;

    }
}

```

I’ve also added the Remote Host Headers in the web ui under **settings** → **Miscellaneous System**

```auto
[                                                                                                                                         
  "HTTP_TRUE_CLIENT_IP",                                                                                                                  
  "HTTP_X_FORWARDED_FOR",                                                                                                                 
  "REMOTE_ADDR",                                    
  "REMOTE_HOST"                                                      
]

```

But after doing all this getting the same result :

```auto
404 page not found

```

I’m sorry that i’m asking again the same thing that have been asked, maybe i’m a bit too silly and i couldn’t figure out what’s that i’m missing.  
Would be great if someone could point me into the right direction.

Thank you very much.

---

<div class="post-metadata">

**Author:** ![jarring](https://avatars.discourse-cdn.com/v4/letter/j/8491ac/32.png) [@jarring](https://forum.ansible.com/u/jarring)\
**Post date:** [August 12, 2024, 10:25am UTC](https://forum.ansible.com/t/awx-behind-a-reverse-proxy-cannot-get-it-working/7665/2 "2024-08-12T10:25:35Z")

</div>

Hello everyone,

I just wanted to ask if anyone would be able to help a little bit on this matter?

Thank you

---

<div class="post-metadata">

**Author:** ![acozine](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@acozine](https://forum.ansible.com/u/acozine)\
**Post date:** [August 12, 2024, 7:17pm UTC](https://forum.ansible.com/t/awx-behind-a-reverse-proxy-cannot-get-it-working/7665/3 "2024-08-12T19:17:17Z")

</div>

You show your two `server` definitions but not your `upstream` definition. Our working solution looks something like this:

```auto
proxy_cache_path /data/nginx/awx/NGINX_cache/ keys_zone=awxcache:10m;

upstream our-awx {
    zone our-awx 64k;
    server awx1.our.domain:443;
    server awx2.our.domain:443;
    sticky learn
          create=$upstream_cookie_awxcookie
          lookup=$cookie_awxcookie
          zone=awxclient_sessions:1m;
}

```

We have two servers, but you can have just one server / one line.

Once we define the `upstream`, we reference it in the `proxy_pass` definition:

```auto
    location / {
        proxy_pass https://our-awx;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_cache awxcache;
. . . 

```

Hope this helps!
