Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding example 'webserver reverse proxy' #2035

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

prothegee
Copy link

drogon framework example: webserver reverse proxy

NOTE:

this example show how to use drogon as webserver and using reverse proxy

steps:

  • add these:

    127.0.0.1   localhost.com
    127.0.0.1   api.localhost.com
    127.0.0.1   admin.localhost.com
    127.0.0.1   www.localhost.com

    to

    • linux debian base location:

      • /etc/hosts:
    • windows base location:

      • C:\Windows\System32\drivers\etc\hosts:

  • make it sure drogon config is already installed on your machine environment

  • build this project, you can use build-debug-linux.sh on linux environment

  • launch:

    • terminal:

      • go to ./bin directory and run each of these:
        • ./drogon_server
        • ./backend_api
        • ./backend_www
    • open your browser:

      • go to:
        • http://www.localhost.com:9999:

          • this will redirect to http://localhost.com:9999
        • http://localhost.com:9999:

          • will show example message and which port is called
        • http://api.localhost.com:9999:

          • will show json message from which port
        • http://api.localhost.com:9999/test:

          • will show json message from /test endpoint/path and show which port is called


preview result example



end of readme

@an-tao
Copy link
Member

an-tao commented May 25, 2024

@prothegee Thanks so much for your patch. I noticed that there is currently a reverse proxy example in the example directory. Is your example different from it? Can you consider submitting your modifications based on the original example?

@prothegee
Copy link
Author

drogon framework is more like http framework arsenal in my mind,
dev user can leverage their existence knowledge to do what their want from drogon framework.

back when example of 'simple_reverse_proxy' exists, I had something in mind to use drogon framework as my core server rather than use nginx or h2o.

back then, I can't figure it out how extend this framework as webserver since it was early year I used drogon framework,
so either I ended up using drogon as one backend in one machine using port 80 & 443 or I mix it up with another webserver.

and yet now I could figure it out how to extend as core server rather than use another webserver/server proxy.


my appoligies to not provide more information as the core purpose of my pr.


the keyword of 'simple example' and 'example' is already different.

to consider as modification from original example, offcourse I believe it's possible.. but the keyword 'simple_reverse_proxy' thou...


perhaps I could provide as 'reverse_proxy', 'webserver_reverse_proxy', or extend 'simple_reverse_proxy'
then decide does this related pr is suitable to be merge or not, requesting permission from you/maintainer.


question:
what does error mean on:

never use this kind of workflow,
and how to fix those error by the way?

@an-tao
Copy link
Member

an-tao commented May 26, 2024

@prothegee Thank you for your patient explanation, I will accept this PR after some code review

@hwc0919
Copy link
Member

hwc0919 commented May 30, 2024

I have a concern about creating large examples.

As drogon release new version, old examples may have compatiblility issues. It's hard to say that example authors will keep maintaining them. At last the maintaining work falls on us. I personally don't feel like to maintain something I don't use at all...

I suggest we create a standalone repo for large examples. At least it won't affect the main project.

@rbugajewski
Copy link
Collaborator

Sure, something like core and extras is a good idea.

@prothegee
Copy link
Author

prothegee commented May 30, 2024

I had related closed issue with this,
[HttpAppFramework / HttpClientPtr ] can't change/set (ssl key, cert, & configuration) after/on plugin

since currently drogon can't change/set included key, cert, & conf on the run,
this example proly useless, unless using wildcard cert key

I think I'm gonna kept it on my branch fork repo or just let it dangle in that closed issue for historical search

@Mis1eader-dev
Copy link
Member

I have swiftly sifted through it and I like the idea of the ReverseProxy plugin.

If we consider merging this, then I'll try to do a full review.

@an-tao
Copy link
Member

an-tao commented May 31, 2024

Based on the above discussion, I think creating a new drogon-examples repo is a solution acceptable to everyone. I will do it ASAP.

@albaropereyra22
Copy link
Contributor

albaropereyra22 commented May 31, 2024 via email

@hwc0919
Copy link
Member

hwc0919 commented May 31, 2024

The Play framework has a repo for each example. That's one approach.

I vote for this

@rbugajewski
Copy link
Collaborator

I think one repo per example is too much, and will only increase burden on the maintainers, but if this organization would be bigger, I would also prefer this approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants