<span style>Hi All,</span><div style><br></div><div style> I'm trying to use nginx as a proxy server which can judge server name by url.</div><div style><br></div><div style> <span style="white-space:nowrap">e.g.</span> </div>
<div style><br></div><div style> server {</div><div style> listen 80 default_server;</div><div style> my_rewrite_directive;</div><div style> }</div><div style><br></div><div style> server {</div><div style>
server_name <a href="http://a.com/" target="_blank" style="color:rgb(17,85,204)">a.com</a>;</div><div style> root html/a;</div><div style> }</div><div style><br></div><div style> server {</div><div style> server_name <a href="http://b.com/" target="_blank" style="color:rgb(17,85,204)">b.com</a>;</div>
<div style> root html/b;</div><div style> }</div><div style><div><br></div><div> then GET /<a href="http://a.com/index.html" target="_blank" style="color:rgb(17,85,204)">a.com/index.html</a> will be redirected to server <a href="http://a.com/" target="_blank" style="color:rgb(17,85,204)">a.com</a>;</div>
</div><div style><br></div><div style>I tried to write a module to accomplish this by modifying members in http request structure, but it seems that r->srv_conf has already been set before running module phases. I tried internal redirect and it didn't help. so my question is, </div>
<div style><br></div><div style>Is there any way to redirect request to another server conf without modifying the nginx core?</div><div style><br></div><div style>Thanks in advance.</div>