Set up an HTTP proxy to insert a header

前端 未结 7 911
[愿得一人]
[愿得一人] 2020-12-12 21:46

I need to test some HTTP interaction with a client I\'d rather not modify. What I need to test is the behavior of the server when the client\'s requests include a certain, s

7条回答
  •  离开以前
    2020-12-12 22:28

    I do something like this in my development environment by configuring Apache on port 80 as a proxy for my application server on port 8080, with the following Apache config:

    NameVirtualHost *
    
       
          Allow from all
       
       
          ProxyPass http://127.0.0.1:8080/myapp
          ProxyPassReverse http://127.0.0.1:8080/myapp
          Header add myheader "myvalue"
          RequestHeader set myheader "myvalue"   
       
    
    

    See LocationMatch and RequestHeader documentation.

    This adds the header myheader: myvalue to requests going to the application server.

提交回复
热议问题