Home > OS >  wordpress nginx proxy subdomain to another subdomain
wordpress nginx proxy subdomain to another subdomain

Time:11-17

I am having a website https://app.domain.com and also have created a promo page using ajax that loads on top and url change to https://app.domain.com#promo

So every time we have the hashtag promo on the homepage, we load the promo page. We also need to have different SEO when hashtag promo is there. We have a huge problem here as hashtags are getting ignored from nginx so we cannot apply proper header tags.

I was thinking to have another subdomain https://promo.app.domain.com that will only proxy to https://app.domain.com#promo

i have tried such solution but wordpress return 404 error. Any ideas?

server {
    server_name promo.app.domain.com;
    location / {
        proxy_set_header Host promo.app.domain.com;
        proxy_pass       https://app.domain.com/#promo;
    }
}

CodePudding user response:

We have a huge problem here as hashtags are getting ignored from nginx so we cannot apply proper header tags.

Not quite.

The real problem is that anchor fragments/URL hash parts, are not actually sent to the server at all. Therefore, no server-side processing can be done with it.

You'll have to use something sent to the server, such as the query string:

https://app.example.com/?promo
  • Related