Is there anyway to configure a https proxy on an android phone to make all requests go through one nginx...












1














I try to use nginx as a https proxy for android phone, nginx config is:



server {
listen 80;
listen 443 ssl;
ssl_certificate "trust-chain.crt";
ssl_certificate_key "key.pem";
location / {
proxy_pass https://127.0.0.1:9000/;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
......


I use this command to generate ssl certificate:



openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365


then I upload cert.pem to https://certificatechain.io/ to generate the intermediate certificate trust-chain.crt. And I install this trust-chain.crt on android phone. Then I modify the http proxy on android wifi settings as follows:



 Proxy: Manual
host: xx.xx.xx.xx
port 80


I can see those "CONNECT xx.xx.xx.xx:443" requests on nginx log, but they are all failed with 400 HTTP code. Where am I doing it wrong?










share|improve this question





























    1














    I try to use nginx as a https proxy for android phone, nginx config is:



    server {
    listen 80;
    listen 443 ssl;
    ssl_certificate "trust-chain.crt";
    ssl_certificate_key "key.pem";
    location / {
    proxy_pass https://127.0.0.1:9000/;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    ......


    I use this command to generate ssl certificate:



    openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365


    then I upload cert.pem to https://certificatechain.io/ to generate the intermediate certificate trust-chain.crt. And I install this trust-chain.crt on android phone. Then I modify the http proxy on android wifi settings as follows:



     Proxy: Manual
    host: xx.xx.xx.xx
    port 80


    I can see those "CONNECT xx.xx.xx.xx:443" requests on nginx log, but they are all failed with 400 HTTP code. Where am I doing it wrong?










    share|improve this question



























      1












      1








      1







      I try to use nginx as a https proxy for android phone, nginx config is:



      server {
      listen 80;
      listen 443 ssl;
      ssl_certificate "trust-chain.crt";
      ssl_certificate_key "key.pem";
      location / {
      proxy_pass https://127.0.0.1:9000/;
      proxy_set_header X-Forwarded-Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }
      ......


      I use this command to generate ssl certificate:



      openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365


      then I upload cert.pem to https://certificatechain.io/ to generate the intermediate certificate trust-chain.crt. And I install this trust-chain.crt on android phone. Then I modify the http proxy on android wifi settings as follows:



       Proxy: Manual
      host: xx.xx.xx.xx
      port 80


      I can see those "CONNECT xx.xx.xx.xx:443" requests on nginx log, but they are all failed with 400 HTTP code. Where am I doing it wrong?










      share|improve this question















      I try to use nginx as a https proxy for android phone, nginx config is:



      server {
      listen 80;
      listen 443 ssl;
      ssl_certificate "trust-chain.crt";
      ssl_certificate_key "key.pem";
      location / {
      proxy_pass https://127.0.0.1:9000/;
      proxy_set_header X-Forwarded-Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }
      ......


      I use this command to generate ssl certificate:



      openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365


      then I upload cert.pem to https://certificatechain.io/ to generate the intermediate certificate trust-chain.crt. And I install this trust-chain.crt on android phone. Then I modify the http proxy on android wifi settings as follows:



       Proxy: Manual
      host: xx.xx.xx.xx
      port 80


      I can see those "CONNECT xx.xx.xx.xx:443" requests on nginx log, but they are all failed with 400 HTTP code. Where am I doing it wrong?







      android ssl nginx http-proxy






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 8:25







      zhengyu

















      asked Nov 23 '18 at 7:47









      zhengyuzhengyu

      1562313




      1562313
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442555%2fis-there-anyway-to-configure-a-https-proxy-on-an-android-phone-to-make-all-reque%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442555%2fis-there-anyway-to-configure-a-https-proxy-on-an-android-phone-to-make-all-reque%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Sphinx de Gizeh

          Dijon

          Guerrita