Welcome! Log In Create A New Profile

Advanced

Cannot pass well to external site + cannot manipulate responses

Posted by ariel135 
Cannot pass well to external site + cannot manipulate responses
October 26, 2017 04:52AM
Hello, i'm new at nginx and i'm trying to set up the proxy to do the following tasks:
1. all requests will be passed into an external site
2. change specific strings (later i want to do more complex logic).

i'm trying to forward all traffic to an external domain for example:

my configuration is as follow:

server {
listen 80;
location / {
proxy_pass https://external.com;

proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;

sub_filter_once off;
sub_filter_types *;
sub_filter "Welcome" "Test";
}

I'm able to be redirected to the external domain and surf, but there are few problems:
1. some sites for example handle csrf attacks, any anything else - i'm aware that i'm going through a proxy but i want to retain all the original requests and i'm not sure what gets lost (for example trello blocks me for csrf detection).
2. the rewrite just doesn't work, nothing in the response body is changed.

Assistance will be appreciated.



Edited 1 time(s). Last edit at 10/26/2017 04:52AM by ariel135.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 271
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