1

I am running a production server and my web application is running at port 8099. so if front end wants to access any backend endpoint, they make a call to this url:

http://production.server.com:8099/mainserver/some/get?xxxxxxx

I need to setup production.server.com:8099 to something like api.production-server.com, which will point to production.server.com:8099. What's the best approach to this? This is for ubuntu platform.

1

For Nginx

server {
     server_name  https://api.production-server.com;
     location / { proxy_pass http://127.0.0.1:8099; }
} 

see this https://stackoverflow.com/a/11034125/1992247

2
  • production.server.com should be replaced with api.production-server.com in my example. It worked. – NullException Jan 13 '14 at 6:24
  • Edited to match the correct server name. – deepseas Jan 13 '14 at 15:06
1

Assuming it is a apache server.

<Proxy *>
    Order deny,allow
    Allow from all
 </proxy>

    ServerName https://production.server.com
    ProxyPass https://api.production-server.com   https://production.server.com:8099
    ProxyPassReverse https://api.production-server.com   https://production.server.com:8099
1
  • We use nginx here. What's the equivalent in nginx for what you suggested? – NullException Jan 10 '14 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.