That is the purpose, I have details about a commercial API and a white label on it.
After by it, I want to resell it to the user of my website.
What is the best way to make redirection of an API to another with same request, parameters, credentials and response back.
Is there online service to do it ? Or a technical example using Java spring or php ?
EXAMPLE :
1. POST, to http://www.commercialapi.com/product/save
{'name': 'customerName', 'nick': 'customerNick'}
2. DELETE, to http://www.commercialapi.com/product/delete
{'id': 'customerId'}
transform to :
1. POST, to http://www.myapi.com/product/save
{'name': 'customerName', 'nick': 'customerNick'}
2. DELETE, to http://www.myapi.com/product/delete
{'id': 'customerId'}
Thanks in advance.
I think Nginx is good solution for this task. You need set Nginx proxy up on your domain.
Try using the nginx reverse proxy
An example Nginx server for your task would be:
server {
listen 80;
server_name www.myapi.com;
location / {
proxy_pass http://www.commercialapi.com;
proxy_redirect http://www.commercialapi.com/ /;
proxy_read_timeout 60s;
# Your can customize headers as well.
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.