Molder Ng
Molder Ng

Reputation: 33

Nginx configuration to resolve Azure billing endpoint

I run azure container with this command successfully:

podman run -d --name document-recognizer -p 5000:5000 -e EULA=accept -e billing=https://azurevn.cognitiveservices.azure.com/ -e apiKey={apikey}  mcr.microsoft.com/azure-cognitive-services/form-recognizer/read-3.1:latest

But my organization cannot reach Internet, so I want to call a proxy service as billing. I'm testing in local nginx, something like:

-e billing=http://localhost:8443/

This is my nginx.conf:

user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {

    server {
        listen 8443;
        server_name localhost;

        location / {
            proxy_pass https://azurevn.cognitiveservices.azure.com/;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_ssl_verify off;
        }
    }
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

my nginx docker command:

podman run -d --name nginx-proxy --add-host azurevn.cognitiveservices.azure.com:20.205.69.100 -p 8443:8443 -v nginx.conf:/etc/nginx/nginx.conf nginx

So after these stuff, I cannot run the azure docker. The error is:

Invalid Billing Endpoint URI. The Billing Endpoint URI can be obtained from Azure Portal by creating an Azure Cognitive Service that supports this container and then use the Endpoint URI.

Is it possible to do this? Thanks a lot.

Upvotes: 0

Views: 78

Answers (0)

Related Questions