Running FlatPress behind a reverse proxy

This is the right place to report general bugs, make suggestions or ask for help.
Post Reply
mike
Posts: 1
Joined: Fri Mar 03, 2023 7:20 am

Running FlatPress behind a reverse proxy

Post by mike » Fri Mar 03, 2023 7:48 am

Hi all. I'm loving FlatPress, but I've got a problem running my blog behind a reverse proxy.

My server is running at my house so I control everything. Connecting to FlatPress within my network works fine (e.g. http://192.168.1.100/blog), but when I try to connect from the external domain (e.g. http://blog.domain.com) through the proxy, the blog connects okay but CSS doesn't work and all links forward to the internal network IP.

This happens routinely when configuring websites with my setup. Generally, I only need to tell an install to make the site URL " / " because the reverse proxy drops traffic right into the site's root directory and doesn't need the website to specify a URL, but I can't make it work with FlatPress. I've tried re-running the installer several times with different URL settings, and I've even tried editing the PHP files directly, but nothing seems to change the site's behavior.

What can I do to get things working? Thanks in advance for your help.

George
Posts: 46
Joined: Tue May 18, 2021 10:54 am
Location: Uk
Contact:

Re: Running FlatPress behind a reverse proxy

Post by George » Sat Mar 04, 2023 11:32 am

are you using nginx ?
Proudly using flatpress https://www.mypoppy.uk/blog

User avatar
fraenkiman
Posts: 223
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Running FlatPress behind a reverse proxy

Post by fraenkiman » Sat Mar 04, 2023 12:30 pm

Hello mike,

welcome on board.
Does the reverse proxy and the web server at your home actually use HTTP (port 80)? Does the problem still exist if you use HTTPS (port 443)?

I recommend you to check the accessibility with these tools. Also check the following points. Feel free to give feedback here.

With best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

User avatar
Arvid
FlatPress Coder
Posts: 581
Joined: Sat Jan 26, 2019 7:40 pm
Contact:

Re: Running FlatPress behind a reverse proxy

Post by Arvid » Sun Mar 05, 2023 12:56 pm

Hi,

did you try to simply set your FlatPress blog URL to https://blog.domain.com ?

All the best,
Arvid

delta_tango
Posts: 1
Joined: Sat Dec 09, 2023 3:25 am

Re: Running FlatPress behind a reverse proxy

Post by delta_tango » Sat Dec 09, 2023 3:46 am

Hi,

I have the same issue. I am behind Nginx Proxy Manager running FlatPress on a docker. The issue here is that you mix http and https. On a local net the data goes as http and outside gets encrypted.

This is how the page looks like:
flatpress.PNG
flatpress.PNG (125.54 KiB) Viewed 19460 times
If I change the code line 128 in the file defaults.php

Code: Select all

$serverport = "http://";
to

Code: Select all

$serverport = "https://";
This works if access from wan but it breaks it for lan access.

If another condition is added to that if block to handle mix of http and https would fix the issue, I guess.

Thank you for great work flatpress team.

Cheers
Delta_Tango

User avatar
fraenkiman
Posts: 223
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Running FlatPress behind a reverse proxy

Post by fraenkiman » Sat Dec 09, 2023 11:56 am

Hello delta_tango,

is the problem solved if you disable public and local IPv4 and only use IPv6?

With best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests