0

I have a Google Spreadsheet that I'd like to serve as a CSV file but hide that it's served or generated by Google. So I published my spreadsheet and got its public URL.

Then I set up an nginx as a reverse proxy with this URL:

server {
    location /sheet.csv {
        proxy_pass "https://docs.google.com/spreadsheets/d/e/2PACX-1vSUlrjaEVBi7EcU4hjRU23GQG5SHXByHq043i8kGAmPOQFfLMXd-p5NRiNyMLIx9psDqb9Qxs3Hcxen/pub?output=csv"; 
    }
}

But when I request it (curl -vL http://127.0.0.1/sheet.csv) the headings leak that the file is served from Google:

HTTP/1.1 307 Temporary Redirect
Location: https://doc-10-1c-sheets.googleusercontent.com/pub/mq6he3r7ig44qobar1fsg51390/2p33rp3pvj2smdslst6hihu19o/1678722040000/104267088953683837464/*/e@2PACX-1vSUlrjaEVBi7EcU4hjRU23GQG5SHXByHq043i8kGAmPOQFfLMXd-p5NRiNyMLIx9psDqb9Qxs3Hcxen?output=csv

I tried setting other proxy options (e.g., proxy_cache, proxy_redirect off, etc) but none of this helped.

For the sake of testing, I tried to use a different URL (e.g., https://stackoverflow.com/robots.txt) and it works (i.e., no StackOverflow host is leaked in headers except the cookies).

I guess, somehow I need to make nginx to handle redirects itself and not send them to client.

0 Answers0