Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How to proxy api call through another domain?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

How to proxy api call through another domain?

So, here is my issue: api.domain1.com only respond to certain IPs. But I need to request it from another location. Is there a way to accomplish something like this:

I am using CloudPanel which is NGINX based. I am open to the idea using Caddy as well.

Comments

  • Brend4nBrend4n Member

    I've done something similar by using Bunny CDN as a proxy

  • With NGINX or Caddy, you can configure a reverse proxy to forward requests from your domain2 to api.domain1 while preserving the source IP address. This way, api.domain1 will receive the request as if it's coming directly from an allowed IP address.

    Here's a high-level overview of how you could set this up:

    Configure NGINX or Caddy on your server to act as a reverse proxy.
    Set up a proxy pass directive in your NGINX or Caddy configuration to forward requests from your domain2 to api.domain1.
    Ensure that the proxy pass preserves the original source IP address in the forwarded request.
    Test the setup to ensure that requests from domain2 are successfully proxied to api.domain1 without api.domain1 being aware of the origin.
    Keep in mind that setting up a reverse proxy requires careful configuration to ensure security and proper functioning. You may need to consult the documentation for NGINX or Caddy and possibly seek assistance from experienced developers or sysadmins if you're not familiar with these technologies.

  • xvpsxvps Member
    edited March 22

    I would use HAProxy a just insert one backend server in the configuration file.

    Basic HAProxy configuration example: https://www.howtoforge.com/how-to-install-haproxy-on-debian-11/#configure-haproxy

    Docs: http://docs.haproxy.org/2.9/configuration.html

    Thanked by 1hades_corps
Sign In or Register to comment.