Welcome! Log In Create A New Profile

Advanced

Proxy pass set body on if

February 16, 2021 10:00AM
I have an Angular app and need to use puppeteer for SSR. In order to make it work I need to send the request with the body but I can't figure how to make these things work together.

if ($limit_bots = 1){
proxy_pass http://localhost:3000/puppeteer/download/html/;
proxy_method GET;
proxy_set_header content-type "application/json";
proxy_pass_request_body off;
proxy_set_body "{\"url\":\"https://$request\"}";
}


location ~ /index.html|.*\.json$ { # Don't cache index.html and *json files
expires -1;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
include /etc/nginx/security-headers.conf;
}


The idea would be to redirect bots to the static html that will be provided by puppeteer runing in another server, and adding proxy_server inside an if is deprecated. I should be using a rewrite statement... but I can't set the body.


Thank you in advance!
Subject Author Posted

Proxy pass set body on if

sanflores February 16, 2021 10:00AM

Re: Proxy pass set body on if

Francis Daly February 21, 2021 10:56AM

Re: Proxy pass set body on if

sanflores February 22, 2021 07:52AM

Re: Proxy pass set body on if

Francis Daly February 22, 2021 01:14PM

Re: Proxy pass set body on if

sanflores February 22, 2021 02:15PM

Re: Proxy pass set body on if

Francis Daly February 22, 2021 04:12PM

Re: Proxy pass set body on if

sanflores February 23, 2021 04:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 266
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready