Re: [pgadmin-support] pgadmin4 running behind nginx

Поиск
Список
Период
Сортировка
От Harshal Dhumal
Тема Re: [pgadmin-support] pgadmin4 running behind nginx
Дата
Msg-id CAFiP3vzQCS6OQAvCP55bwVEm-Z+pCSxBrFFgqSDMUzMTtGUJ3Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [pgadmin-support] pgadmin4 running behind nginx  (Harshal Dhumal <harshal.dhumal@enterprisedb.com>)
Ответы Re: [pgadmin-support] pgadmin4 running behind nginx
Список pgadmin-support
Hi,

When I setup my machine with below server setup and without proxy_redirect I got slightly different behaviour. In my case all redirects were failing cause browser was redirecting all request to http while server (nginx) was configure to serve only https. I didn't get any intermittent state like pgAdmin4 front page was loading but other requests (like css, js) was failing.

Issue was when pgAdmin4 app returns redirect (301 /302) response to apache and apache to nginx; the nginx was returning redirect location header as is (i.e. with http protocol as apache was configured to accept only http)

To avoid this I need to rewrite location header at nginx (proxy_redirect) before sending it to browser.
        
        proxy_set_header X-Real-IP  $remote_addr; 
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:81;
        proxy_redirect http:// https://;

With above nginx configuration pgAdmin was loading properly.

Server setup:

Nginx listing at 443 (https only) and forwarding all requests to apache at 127.0.0.1:81
Apache listing at port 81 (http only) with pgAdmin4 wsgi



-- 
Harshal Dhumal
Software Engineer

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Mon, Jan 30, 2017 at 4:44 PM, Harshal Dhumal <harshal.dhumal@enterprisedb.com> wrote:


-- 
Harshal Dhumal
Software Engineer

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Mon, Jan 30, 2017 at 3:33 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Sun, Jan 29, 2017 at 7:33 PM, jbiskofski <jbiskofski@gmail.com> wrote:
> Hello everyone,
>
> I have installed pgadmin4 on apache 2.2 with mod_wsgi, and it seems to be
> working correctly.
>
> The problem is I need to run nginx in front of it to enable https and
> caching. When I try to access pgadmin with this setup I get errors in the
> browser about some elements not being able to be loaded because they are
> linked through http instead of https.
>
> login:1 Mixed Content: The page at
> 'https://REMOVED-BY-ME/login?next=/browser/browser.css' was loaded over
> HTTPS, but requested an insecure stylesheet
> 'http://REMOVED-BY-ME/login?next=%2Fbrowser%2Fbrowser.css'. This request has
> been blocked; the content must be served over HTTPS.

Harshal, can you take a look at this please? I can see my browser
loading http://127.0.0.1:5050/login?next=%2Fbrowser%2Fbrowser.css, but
I cannot see why. I must be overlooking something.

Yes sure I'll look in to this.
 
> This is OK at the login page, but once I login, I get the eternal pgadmin is
> loading screen and a lot more of these same errors in my browser console.
>
> My question is, how can I tell pgadmin4 what its base URL is ?

You can tell it the directory root (though you shouldn't need to), but
I know of no way to give it the base URL. Normally it figures it out
itself - but then normally we also wouldn't put Apache behind Nginx,
but just setup SSL directly on Apache.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


В списке pgadmin-support по дате отправления:

Предыдущее
От: Dave Page
Дата:
Сообщение: Re: [pgadmin-support] 4th Try: pgadmin4 install, launch fail
Следующее
От: Dave Page
Дата:
Сообщение: Re: [pgadmin-support] pgadmin4 running behind nginx