The problem was the sql database that did not update urls. I do not know if there is a way to do this easily but I feel like I have looked everywhere for this solution and finally found it with this answer to a somewhat similar question : https://premium.wpmudev.org/forums/topic/how-to-change-url-for-wp-multi-site#post-426799
I started over from where everything works locally (from ip address) then from there I went into the database to change :
- siteurl and home from wp_options to http://www.example.net/
- siteurl and home from wp_{blog_id}_options to http://www.example.net/{blog} (where {blog_id} is the ID of the additional sites and {blog} is sub1 and sub2)
- domain from wp_site and wp_blogs to www.example.net
If I leave this as is I’ll get a Error establishing a database connection
As the above link says to I went back to the wp-config file to change the DOMAIN_CURRENT_SITE to www.example.net.
Letting this as is I get a gateway error, so I went to the reverse proxy and added this bit to the wordpress server location :
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header Host $host;
And voila! WordPress multisite behind a reverse proxy!
If I want to add a new subsite It keeps all the good info, so I don’t need to redo this. The only “downside” is that I cannot access the website from the local ip anymore, but then I’d just need to go over these steps and change the domain for the ip tol go back.