• Resolved cxtinac

    (@cxtinac)


    We have a fully configured WordPress/Woocommerce installation at “wordpress.example.com“, and an nginx proxy in front of it at “public.example.com“, all working well, except for this:

    In order for the payment gateway to get & display the correct url (public.example.com/…) to send customers back to after processing, we have to set wordpress urls as follows:

    home       | https://public.example.com
    siteurl     | https://wordpress.example.com

    This is tantalizing close to all working. The only problem is that a request for the home page (specifically and only) at https://public.example.com results in a 301 redirect loop. All other pages work as expected.

    I can see what the problem is – on the front end the stanza:

    server_name public.example.com;
    ...
    proxy_pass https://wordpress.example.com;

    will indeed send the request to exactly https://wordpress.example.com/ but wordpress then replies with no, no – 301, you need to head over to https://public.example.com and the browser ends up in a loop.

    I cannot see how to specifically prevent wordpress from issuing a 301 for wordpress.example.com (only) and instead return 200 OK and the content.

    Can anyone help please?

Viewing 1 replies (of 1 total)
  • Thread Starter cxtinac

    (@cxtinac)

    To answer my own question, this was caused because I stupidly forgot to set the Host header:
    proxy_set_header Host public.example.com;

Viewing 1 replies (of 1 total)

The topic ‘WordPress home page redirect loop behind proxy’ is closed to new replies.