Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm looking for a way to modify the body of a response created by some webserver to which I proxy my requests using Nginx:

server {
    listen   80;
    server_name localhost;

    location /myproject/ {
        proxy_pass http://127.0.0.1:8080/myproject/;
        > modify response from http://127.0.0.1:8080/myproject/ before sending
    }
}

It's something like HttpSubModule but with an external program rather than simple text replacement. The modifying program is a Node.js webserver, so I thought about sending the response in a post request. But that's just a brief idea, every kind of approach is highly appreciated.

share|improve this question

1 Answer 1

I've always liked nginx's XSLT processor for jobs like those. Wrote a lengthy blog post on that last year, too - shameless plug: http://ef.gy/using-nginx-as-a-proxy-server -- scroll down a bit to the XSLT part.

nginx's XSLT processor will also let you use data from other sources with the document function.

share|improve this answer
    
A very promising approach. Thanks for the article. I'll have a closer look before accepting this as answer. –  Sebastian vom Meer Jan 16 '13 at 10:11
    
Well, sadly it requires a bit of a knack for XSLT 1.0, which tends to scare people off, but it did seem relevant to your problem. Worst case it'll give you a new angle ;). –  Magnus Jan 16 '13 at 10:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.