nginx as ssl reverse proxy for wildfly

247

Solution 1

Marko, maybe too late, but I was able to get nginx and wildfly working following your configuration, let me share that:

In proxy_headers.conf:

proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
add_header Front-End-Https on;

In my app.conf

location / {
   include conf.d/proxy_headers.conf;
   proxy_pass http://127.0.0.1:8080;
}

location /management {
   include conf.d/proxy_headers.conf;
   proxy_pass http://127.0.0.1:9990/management;
}

location /console {
   include conf.d/proxy_headers.conf;
   proxy_pass http://127.0.0.1:9990/console;
}

location /logout {
   include conf.d/proxy_headers.conf;
   proxy_pass http://127.0.0.1:9990/logout;
}

location /error {
   include conf.d/proxy_headers.conf;
   proxy_pass http://127.0.0.1:9990;
}

Before I did this I faced the same error as you so using developer tools in Chrome I figured out that ajax requests to /management and the others paths are done so I took care of them.

Solution 2

Try to add this in server config:

add_header Cache-Control "no-cache, no-store";

Solution 3

Perhaps a little late, but this info may help.

I has the same issue with a front-end Nginx proxy (without SSL) and WildFly 8.2.0.Final in Docker. Same error when trying to access the Administration Console through Nginx.

Discovered that WildFly expects the Host header in the form of HOST:PORT (by comparing headers from packets captured through tcpdump and analysed in Wireshark).

Here's my configuration, should it help anyone:

upstream app-debug {
  ip_hash;
  server AA.BB.CC.DD:32862 max_fails=3 fail_timeout=20 weight=1;
}

server {
  listen 9990 default_server;
  location / {
    proxy_pass http://app-debug;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $server_addr:$server_port;
    proxy_set_header X-Real-IP $remote_addr;
  }
}

Hope this helps.

Share:
247

Related videos on Youtube

Ashish Sharawat
Author by

Ashish Sharawat

Updated on September 18, 2022

Comments

  • Ashish Sharawat
    Ashish Sharawat over 1 year

    I'm trying to make a gallery page for my Django application and I want to display images of specific category on their respective pages but the issue I face is I'm unable to apply filter for that like I have several images related to food and some related to travel I want to display all food images on a food page and all travel images on its travel page I have created a drop-down list of my all pages to display that image please have a look on this screenshot https://prnt.sc/qnznml ! I tried def get_queryset(self): return Postgallery.objects.filter(postgallery_id=self.kwargs.get('slug')) but it does't work

    Modeld.py

        class Page(models.Model):
        heading = models.CharField(max_length=50,null=True)
        overview = models.TextField(null=True)
        backgroung = models.ImageField()
    
        def __str__(self):
            return self.heading
    class Postgallery(models.Model):
        title = models.CharField(max_length=50, verbose_name="Title")
        overview = models.TextField(null=True)
        slug = models.SlugField(null=True)
    
        def __str__(self):
            return self.title
    
        def get_absolute_url(self):
            return reverse('gallery-detial', kwargs={'slug': self.slug})
    
    
    class Photos(models.Model):
        image = models.ImageField()
        title = models.CharField(max_length=50,null=True)
        page = models.ForeignKey(Postgallery, on_delete=models.CASCADE, verbose_name="Postgallery")
        featured = models.BooleanField()
        show = models.BooleanField()
    
        def __str__(self):
            return self.title
    
        def get_queryset(self):
            return Postgallery.objects.filter(postgallery_id=self.kwargs.get('slug'))
    
    • Marko
      Marko almost 10 years
      It turns out that it did not work in chrome but it works with Firefox. So it was browser issue.