C
C
ccakoxo2017-05-22 04:21:17
Nginx
ccakoxo, 2017-05-22 04:21:17

How to proxy third party API?

How to proxy a third party API server?
More precisely, there is a server that sends content from its example.com domain to my site.com site. I want the end user to not be able to see requests for example.com, i.e. to get it all through my primer.com domain.
How to implement it? Is it possible through nginx? Naturally, without prescribing all the paths manually, simply by setting that all requests from such and such a domain are directed to such and such, and already in the application code I will indicate my domain.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RidgeA, 2017-05-22
@ccakoxo

More or less like this.
I do not guarantee that it will work in this form, but the direction is somewhere in this direction

...
server_name primer.com
...
location = /api {
    proxy_pass http://example.com/;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question