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

Here is my current config:

server {
    location ~ ^/bugsbunny/?(.*)$ {
        proxy_set_header Host $host;
        proxy_pass       http://127.0.0.2:8080/cartoon/network/$1;
    }
}

I've been trying to figure out how to reverse-proxy requests and preserve the original host. For example let's say I have http://127.0.0.1/bugsbunny as my front-end and I want to reverse-proxy the requests to http://127.0.0.2:8080/cartoon/network. How to preserve the original url so that http://127.0.0.2:8080/cartoon/network/something/other would become http://127.0.0.1/bugsbunny/something/other on the front-end ?

P.S. I tried using proxy_set_header Host $host; but this preserves only the original host.

share|improve this question
add comment

1 Answer

Actually I found it myself. You have to rewrite the links yourself via HttpSubModule. Be sure to set sub_filter_once off so that it replaces all the links on the page, not just the first one it finds.

share|improve this answer
add comment

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.