WebCal
Ctrl K

ガイド

Load Balancing

ガイド連携FAQサポート
価格ブログ
クイックスタートTop-Up and BillingAccelerating Access to Academic ResourcesQuick StartIntroductionMaintenance and TroubleshootingNetwork
プラットフォームJetBrain ProjectorTmpWebCal Scholars Program @2026Introduction to the Public Beta/Suqian Zone AAbout UsCopying Data Between InstancesAnalysis of Server Performance MetricsTidal Computing PowerLoad Balancing
中国製チップUsing Huawei MindIEHuawei Ascend NPUMooreThread GPU
環境設定CUDA/cuDNNMinicondaPython3.XInstalling DependenciesOverviewImages
エンタープライズ機能Flexible DeploymentElastic Deployment Release NotesBest Practices for Elastic DeploymentPerformance Metrics Monitoring
コンテナインスタンスJupyterLabRemote SSH ConnectionSave the imageScaling ConfigurationMulti-machine, multi-GPU parallel processingDaemonOverviewChange the billing methodMigration Example (Same Region)Migration ExamplesRemote DesktopReset the system
GPU の選び方GPU SelectionPerformance Testing
データUpload DataDownload DataPublic DataPublic Cloud Storage (Highly Recommended)Compression / DecompressionFile StorageLocal data diskOverview
ベストプラクティスFileZillaGitGromacsHuggingFaceKataGoLinux BasicsMPIOpenCLPyCharm Remote DevelopmentR (RStudio) InstallationSSH TunnelTensorBoardRemote Development with VSCodeVisdomVulkanXShellOpen PortsWeChat MessagesPerformanceExpose multiple servicesMoney-Saving TipsComputation Precision IssuesSoftware Sources

プラットフォーム

Load Balancing

2026/07/3069245の閲覧数

If you have launched services on different instances and are using Nginx to load balance these services, you may encounter a 404 error when directly using Nginx Upstream for proxying.The reason is as follows: Since WebCal needs to route requests to different instances based on the Host header in the user’s request (you’ll notice that the domain names in the URLs of different instances are different; under normal circumstances, the domain name from which the request originates is set in the Host header),when using Nginx to proxy multiple backend services, the address of the user’s frontend request is that of the server hosting Nginx. However, when Nginx forwards the request to WebCal, it cannot reset the Host variable in the request headers to WebCal’s domain name, resulting in failed access.Below are two methods for implementing proper proxying: 1. A workaround approach, suitable for scenarios with a small number of services to proxy; 2. A method using Lua scripts, which is more versatile but also more complex.

A More Clever Approach

server {
  listen      8001 default_server;
  server_name a.example.com;
  location / {
    proxy_set_header Host a.cqa1.seetacloud.com:8443;
    proxy_pass       https://a.cqa1.seetacloud.com:8443;
  }
}

server {
  listen      8002 default_server;
  server_name b.example.com;
  location / {
    proxy_set_header Host b.cqa1.seetacloud.com:8443;
    proxy_pass       https://b.cqa1.seetacloud.com:8443;
  }
}

upstream main_balancer {
  server 127.0.0.1:8001;
  server 127.0.0.1:8002;
}

server {
  listen      80;
  server_name example.com;
  location / {
    proxy_pass http://main_balancer;
  }
}

Using Lua Scripts

Nginx Configuration

server {
  listen      8000 default_server;
  server_name web1.example.com;
  location / {
    set $proxy_pass_target "";
    set_by_lua_file $proxy_pass_target /usr/local/openresty/nginx/lua/xxxxxx.lua;
    if ($proxy_pass_target = ""){
        return 404;
    }
    proxy_set_header Host $proxy_pass_target;
    proxy_pass       https://$proxy_pass_target;
  }
}

Lua scripts

local servers = {
    ["0"] = "a.cqa1.seetacloud.com:8443",
    ["1"] = "b.cqa1.seetacloud.com:8443",
    ["2"] = "c.cqa1.seetacloud.com:8443",
}
local path = ngx.var.uri
local target = ""

if path == "/api/v1" then
    target = "api_v1.example.com"
elseif path == "/api/v2" then
    target = "api_v2.example.com"
else
    target = "default.api.example.com"
end

return target
次の記事R (RStudio) Installation
コンピューティングレンタルに関するドキュメントガイドに戻る