Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid port in upstream #287

Open
Tesfa1074 opened this issue Oct 10, 2024 · 0 comments
Open

Invalid port in upstream #287

Tesfa1074 opened this issue Oct 10, 2024 · 0 comments

Comments

@Tesfa1074
Copy link

Tesfa1074 commented Oct 10, 2024

Describe the bug
I am having the following issue using the relay proxy after configuration.

Error

10 October 2024 at 10:48 (UTC+2:00) | 2024/10/10 08:48:50 [error] 37#37: *209 invalid port in upstream "https://manager.us.smartlook.cloud", client: 10.100.22.225, server: , request: "POST /manager/rec/setup-recording/website HTTP/1.1", host: "<proxy-host>:8585", referrer: "https://<custom-domain>/" | a22c36a3aa8442f78f5e329affacefcd | worker
-- | -- | -- | --
10 October 2024 at 10:48 (UTC+2:00) | 10.100.22.225 - - [10/Oct/2024:08:48:50 +0000] "POST /manager/rec/setup-recording/website HTTP/1.1" 500 572 "<custom-domain>" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"

10 October 2024 at 10:48 (UTC+2:00)
2024/10/10 08:48:50 [error] 37#37: *209 invalid port in upstream "https://manager.us.smartlook.cloud", client: 10.100.22.225, server: , request: "POST /manager/rec/setup-recording/website HTTP/1.1", host: "<proxy-host>:8585", referrer: "<custom-domain>"

10 October 2024 at 10:48 (UTC+2:00)
10.100.22.225 - - [10/Oct/2024:08:48:50 +0000] "POST /manager/rec/setup-recording/website HTTP/1.1" 500 572 "<custom-domain>" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"

Proxy is running on AWS ECS.

To Reproduce
Docker config for my ECS

FROM nginx:1-alpine

ARG COMMIT_SHA="unknown"

COPY ./nginx/templates /etc/nginx/templates
COPY --chmod=0555 ./nginx/entrypoint.sh /docker-entrypoint.d/40-smartlook-relay-proxy.sh

ENV COMMIT_SHA=${COMMIT_SHA}
ENV PROXY_PORT=8000
ENV CLIENT_MAX_BODY_SIZE=20m
ENV ERROR_LOG_LEVEL=error
ENV WEB_SDK_HOST=web-sdk.smartlook.com
ENV MANAGER_HOST=manager.us.smartlook.cloud
ENV ASSETS_PROXY_HOST=assets-proxy.smartlook.cloud
ENV WEB_SDK_WRITER_HOST=web-writer.us.smartlook.cloud
ENV MOBILE_SDK_WRITER_HOST=sdk-writer.us.smartlook.cloud

EXPOSE ${PROXY_PORT}

NGINX Config

map $status $loggable {
    ~^[23]  0;
    default 1;
}

server {
    listen ${PROXY_PORT};
    
    proxy_cache off;
    proxy_ssl_server_name on;
    proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    server_tokens off;
    client_max_body_size ${CLIENT_MAX_BODY_SIZE};

    error_log /dev/stderr ${ERROR_LOG_LEVEL};
    access_log /dev/stdout combined if=$loggable;

    location /proxy/status {
        default_type application/json;

        return 200 '{ "app": "smartlook-relay-proxy", "version": "${COMMIT_SHA}" }';
    }

    set $manager_host ${MANAGER_HOST};
    set $assets_proxy_host ${ASSETS_PROXY_HOST};
    set $web_sdk_writer_host ${WEB_SDK_WRITER_HOST};
    set $mobile_sdk_writer_host ${MOBILE_SDK_WRITER_HOST};
    set $web_sdk_host ${WEB_SDK_HOST};

    proxy_pass_header Server;

    resolver 1.1.1.1 1.0.0.1 valid=5m;

    location /manager/ {
        rewrite ^/manager(/.*)$ $1 break;
        proxy_pass https://$manager_host;

        proxy_set_header Host $manager_host;
        proxy_set_header X-Forwarded-Host $manager_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_set_header X-Forwarded-By smartlook-relay-proxy;
    }

    location /assets/ {
        rewrite ^/assets(/.*)$ $1 break;
        proxy_pass https://$assets_proxy_host;

        proxy_set_header Host $assets_proxy_host;
        proxy_set_header X-Forwarded-Host $assets_proxy_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_set_header X-Forwarded-By smartlook-relay-proxy;
    }

    location /web-writer/ {
        rewrite ^/web-writer(/.*)$ $1 break;
        proxy_pass https://$web_sdk_writer_host;

        proxy_set_header Host $web_sdk_writer_host;
        proxy_set_header X-Forwarded-Host $web_sdk_writer_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_set_header X-Forwarded-By smartlook-relay-proxy;
    }

    location /sdk-writer/ {
        rewrite ^/sdk-writer(/.*)$ $1 break;
        proxy_pass https://$mobile_sdk_writer_host;

        proxy_set_header Host $mobile_sdk_writer_host;
        proxy_set_header X-Forwarded-Host $mobile_sdk_writer_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_set_header X-Forwarded-By smartlook-relay-proxy;
    }

    location / {
        proxy_pass https://$web_sdk_host;

        proxy_set_header Host $web_sdk_host;
        proxy_set_header X-Forwarded-Host $web_sdk_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_set_header X-Forwarded-By smartlook-relay-proxy;
    }
}

Desktop (please complete the following information):

  • OS: Any
  • Browser: Chrome
  • Version: Any
@Tesfa1074 Tesfa1074 changed the title SSL handshaking to upstream alert number 40 Invalid port in upstream Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant