Mixing http and http2 under the same server on nginx2019 Community Moderator ElectionShare Nginx server configurationNGINX Proxy http://somedomain.com/proxythis to React AppServing Python (Flask) REST API over HTTP2How do I serve static files from either gunicorn or nginxDeploy an https docker registry behind nginx on AWSGodaddy DNS to AWS EC2Connection Was Reset for local docker nginx instanceServing flask app that takes in arguments using nginx and gunicornHow to configure nginx properly with gunicorn and flask?nginx proxy_pass connection refused for flask development server

Gantt Chart like rectangles with log scale

Do the common programs (for example: "ls", "cat") in Linux and BSD come from the same source code?

Define, (actually define) the "stability" and "energy" of a compound

Are all passive ability checks floors for active ability checks?

My adviser wants to be the first author

Do I need life insurance if I can cover my own funeral costs?

How to deal with a cynical class?

Why do passenger jet manufacturers design their planes with stall prevention systems?

Time travel from stationary position?

Hacking a Safe Lock after 3 tries

Does someone need to be connected to my network to sniff HTTP requests?

Is it possible to upcast ritual spells?

Python if-else code style for reduced code for rounding floats

What exactly is this small puffer fish doing and how did it manage to accomplish such a feat?

Sailing the cryptic seas

How could a scammer know the apps on my phone / iTunes account?

If I can solve Sudoku can I solve Travelling Salesman Problem(TSP)? If yes, how?

What should tie a collection of short-stories together?

If curse and magic is two sides of the same coin, why the former is forbidden?

The difference between「N分で」and「後N分で」

Existence of subset with given Hausdorff dimension

What's the meaning of “spike” in the context of “adrenaline spike”?

Are there verbs that are neither telic, or atelic?

Should we release the security issues we found in our product as CVE or we can just update those on weekly release notes?



Mixing http and http2 under the same server on nginx



2019 Community Moderator ElectionShare Nginx server configurationNGINX Proxy http://somedomain.com/proxythis to React AppServing Python (Flask) REST API over HTTP2How do I serve static files from either gunicorn or nginxDeploy an https docker registry behind nginx on AWSGodaddy DNS to AWS EC2Connection Was Reset for local docker nginx instanceServing flask app that takes in arguments using nginx and gunicornHow to configure nginx properly with gunicorn and flask?nginx proxy_pass connection refused for flask development server










0















I'm trying to have a single server on nginx serving both http2 routes and traditional http1 routes, my problem is that I cannot get it to play nicely.



When I try to access my app on the subfolder, that runs on gunicorn+flask, I get a download file with some binary



How can I serve both?




server
listen 80 http2;

access_log /dev/stdout main;
rewrite_log on;
error_log /dev/stdout debug;

location /some.Service
grpc_pass grpc://srvadd:10116;


location /password-reset
proxy_pass http://flask:8000;












share|improve this question






















  • If you remove the gRPC endpoint, does the proxy_pass to Flask then work properly, or does the issue persist?

    – hexacyanide
    Mar 3 at 21:36















0















I'm trying to have a single server on nginx serving both http2 routes and traditional http1 routes, my problem is that I cannot get it to play nicely.



When I try to access my app on the subfolder, that runs on gunicorn+flask, I get a download file with some binary



How can I serve both?




server
listen 80 http2;

access_log /dev/stdout main;
rewrite_log on;
error_log /dev/stdout debug;

location /some.Service
grpc_pass grpc://srvadd:10116;


location /password-reset
proxy_pass http://flask:8000;












share|improve this question






















  • If you remove the gRPC endpoint, does the proxy_pass to Flask then work properly, or does the issue persist?

    – hexacyanide
    Mar 3 at 21:36













0












0








0








I'm trying to have a single server on nginx serving both http2 routes and traditional http1 routes, my problem is that I cannot get it to play nicely.



When I try to access my app on the subfolder, that runs on gunicorn+flask, I get a download file with some binary



How can I serve both?




server
listen 80 http2;

access_log /dev/stdout main;
rewrite_log on;
error_log /dev/stdout debug;

location /some.Service
grpc_pass grpc://srvadd:10116;


location /password-reset
proxy_pass http://flask:8000;












share|improve this question














I'm trying to have a single server on nginx serving both http2 routes and traditional http1 routes, my problem is that I cannot get it to play nicely.



When I try to access my app on the subfolder, that runs on gunicorn+flask, I get a download file with some binary



How can I serve both?




server
listen 80 http2;

access_log /dev/stdout main;
rewrite_log on;
error_log /dev/stdout debug;

location /some.Service
grpc_pass grpc://srvadd:10116;


location /password-reset
proxy_pass http://flask:8000;









nginx grpc






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 2 at 18:44









perrohunterperrohunter

2,20072849




2,20072849












  • If you remove the gRPC endpoint, does the proxy_pass to Flask then work properly, or does the issue persist?

    – hexacyanide
    Mar 3 at 21:36

















  • If you remove the gRPC endpoint, does the proxy_pass to Flask then work properly, or does the issue persist?

    – hexacyanide
    Mar 3 at 21:36
















If you remove the gRPC endpoint, does the proxy_pass to Flask then work properly, or does the issue persist?

– hexacyanide
Mar 3 at 21:36





If you remove the gRPC endpoint, does the proxy_pass to Flask then work properly, or does the issue persist?

– hexacyanide
Mar 3 at 21:36












1 Answer
1






active

oldest

votes


















0














hm, serving both http and http2 traffic under the same nginx server should work. This is one example nginx.conf that works for us



server 
listen 8080;
listen 8443 http2;
server_name localhost;

location /
grpc_pass localhost:9090;




I am not entirely sure, but does port 80 work with http2? I think there might be some restriction on what port number you can use with http2?



another slightly more involved example



 server 
listen [::]:$0;
listen [::]:$1 http2;
server_name localhost;
location /grpc.gateway.testing.EchoService/
grpc_pass localhost:$2;
grpc_channel_reuse on;
grpc_ssl $3;
grpc_ssl_target_name_override $4;
grpc_ssl_pem_root_certs "$5";
grpc_ssl_pem_private_key "$6";
grpc_ssl_pem_cert_chain "$7";
grpc_client_liveness_detection_interval 10ms;
add_header Access-Control-Allow-Origin * always;







share|improve this answer






















    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%2f54961819%2fmixing-http-and-http2-under-the-same-server-on-nginx%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    hm, serving both http and http2 traffic under the same nginx server should work. This is one example nginx.conf that works for us



    server 
    listen 8080;
    listen 8443 http2;
    server_name localhost;

    location /
    grpc_pass localhost:9090;




    I am not entirely sure, but does port 80 work with http2? I think there might be some restriction on what port number you can use with http2?



    another slightly more involved example



     server 
    listen [::]:$0;
    listen [::]:$1 http2;
    server_name localhost;
    location /grpc.gateway.testing.EchoService/
    grpc_pass localhost:$2;
    grpc_channel_reuse on;
    grpc_ssl $3;
    grpc_ssl_target_name_override $4;
    grpc_ssl_pem_root_certs "$5";
    grpc_ssl_pem_private_key "$6";
    grpc_ssl_pem_cert_chain "$7";
    grpc_client_liveness_detection_interval 10ms;
    add_header Access-Control-Allow-Origin * always;







    share|improve this answer



























      0














      hm, serving both http and http2 traffic under the same nginx server should work. This is one example nginx.conf that works for us



      server 
      listen 8080;
      listen 8443 http2;
      server_name localhost;

      location /
      grpc_pass localhost:9090;




      I am not entirely sure, but does port 80 work with http2? I think there might be some restriction on what port number you can use with http2?



      another slightly more involved example



       server 
      listen [::]:$0;
      listen [::]:$1 http2;
      server_name localhost;
      location /grpc.gateway.testing.EchoService/
      grpc_pass localhost:$2;
      grpc_channel_reuse on;
      grpc_ssl $3;
      grpc_ssl_target_name_override $4;
      grpc_ssl_pem_root_certs "$5";
      grpc_ssl_pem_private_key "$6";
      grpc_ssl_pem_cert_chain "$7";
      grpc_client_liveness_detection_interval 10ms;
      add_header Access-Control-Allow-Origin * always;







      share|improve this answer

























        0












        0








        0







        hm, serving both http and http2 traffic under the same nginx server should work. This is one example nginx.conf that works for us



        server 
        listen 8080;
        listen 8443 http2;
        server_name localhost;

        location /
        grpc_pass localhost:9090;




        I am not entirely sure, but does port 80 work with http2? I think there might be some restriction on what port number you can use with http2?



        another slightly more involved example



         server 
        listen [::]:$0;
        listen [::]:$1 http2;
        server_name localhost;
        location /grpc.gateway.testing.EchoService/
        grpc_pass localhost:$2;
        grpc_channel_reuse on;
        grpc_ssl $3;
        grpc_ssl_target_name_override $4;
        grpc_ssl_pem_root_certs "$5";
        grpc_ssl_pem_private_key "$6";
        grpc_ssl_pem_cert_chain "$7";
        grpc_client_liveness_detection_interval 10ms;
        add_header Access-Control-Allow-Origin * always;







        share|improve this answer













        hm, serving both http and http2 traffic under the same nginx server should work. This is one example nginx.conf that works for us



        server 
        listen 8080;
        listen 8443 http2;
        server_name localhost;

        location /
        grpc_pass localhost:9090;




        I am not entirely sure, but does port 80 work with http2? I think there might be some restriction on what port number you can use with http2?



        another slightly more involved example



         server 
        listen [::]:$0;
        listen [::]:$1 http2;
        server_name localhost;
        location /grpc.gateway.testing.EchoService/
        grpc_pass localhost:$2;
        grpc_channel_reuse on;
        grpc_ssl $3;
        grpc_ssl_target_name_override $4;
        grpc_ssl_pem_root_certs "$5";
        grpc_ssl_pem_private_key "$6";
        grpc_ssl_pem_cert_chain "$7";
        grpc_client_liveness_detection_interval 10ms;
        add_header Access-Control-Allow-Origin * always;








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 6 at 19:50









        Stanley CheungStanley Cheung

        911




        911





























            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54961819%2fmixing-http-and-http2-under-the-same-server-on-nginx%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

            Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

            Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

            Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved