2

I have a windows server with IIS running on it with a whole bunch of applications. For one of the application, we need to install Nginx for reverse proxy. We have to call dynamic files from a vendor. Nginx was installed on a different port 8070 since IIS was already on port 80.

The nginx.conf file was updated to reflect a different port. Here is a part of the file that was updated:

server {

    listen      8070;
    server_name localhost;



    location / {
        root   html;
       index  index.html index.htm;
    }

    location /abc/{
    proxy_pass https://my.vendor.com/;
    proxy_set_header Host $host:$server_port;
    proxy_redirect http://localhost/ http://localhost:8070/;
    }

However, when the application tries to access the dynamic files from the vendor, the URL has missing port 8070 and it throws 404 error. I have been playing around the nginx.conf file for days now but still no luck. For the dynamic URL that is generated, if I add the port 8070, there is no issue in accessing the dynamic file from the vendor.

Current URL pattern generated to access the vendor dynamic file. It throws 404 error: http://localhost/abc/VendorDyn.js?load=true&pp=true&mm=false&fptrue&hm=true&er=false

However, it should be as follows with the port number http://localhost:8070/abc/VendorDyn.js?load=true&pp=true&mm=false&fptrue&hm=true&er=false

Is there anything I am missing in the nginx.conf file that will add the port to the URL?

I also tried using the following for the server in the conf file:

 server {       
        listen      localhost:8070;

However, this also didn't help.

Any help or comment will be appreciated. I can;t have Nginx on port 80. I need to have it on a different port than 80.

Thanks.

2
  • 1
    You need to configure your application behind the proxy to generate the URLs with the custom port. But why don't you just configure the reverse proxy in IIS? You don't even need the nginx instance. Feb 14, 2019 at 7:29
  • Are you talking about ARR in IIS? So there is no way to have the custom port in the URL generated during reverse proxy in nginx?
    – Sugar Bowl
    Feb 14, 2019 at 17:17

0

You must log in to answer this question.

Browse other questions tagged .