I have a seq server installed on a windows server 2022 vps, i have also nginx set as a reverse proxy for "MyApp" and the "Seq" server, no load balancing configured, just reverse proxying.
The probleme: When i try to access seq server ui from h t t p : / / l o c a l h o s t : /seq/ it works perfectly, no issues, but when i try to access it from an external machine using my VPS ip it gives me, "Bad Request - Invalid Hostname HTTP Error 400. The request hostname is invalid." It's worth noting that "MyApp" (an asp.ner core app) is perfectly working when i access it from external machine (h t t p : / / xx.xx.xx.xx : 80 /MyApp/), this means that nginx is correctly working and configured for MyApp.
On my vps, nginx/logs/error.txt:
2023/08/22 09:04:15 [error] 3064#1044: *7 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: 127.0.0.1, server: xx.xx.xx.xx, request: "GET /seq/seq-ui2-tpl-1690501959253.min.js HTTP/1.1", upstream: "http://127.0.0.1:5005/seq-ui2-tpl-1690501959253.min.js", host: "localhost", referrer: "http://localhost/seq/"
2023/08/22 09:04:15 [warn] 3064#1044: *7 upstream server temporarily disabled while connecting to upstream, client: 127.0.0.1, server: xx.xx.xx.xx, request: "GET /seq/seq-ui2-tpl-1690501959253.min.js HTTP/1.1", upstream: "http://127.0.0.1:5005/seq-ui2-tpl-1690501959253.min.js", host: "localhost", referrer: "http://localhost/seq/"
My set up:
- Seq is running as a service.
- Seq.exe is allowed to recieve inbound connexions on it's functionning port (5005 in my case)
- Seq config:
I tried many nginx configurations that i found, but none works, i also tried to configure seq server, i set api.canonicalURI to h t t p : / / l o c a l h o s t, and api.ingestionPorts to 5005, but nothing works.
api.canonicalUri=
api.corsAllowedOrigins=
api.frameAncestors=
api.hardSessionExpirySeconds=
api.hstsIncludeSubDomains=False
api.hstsMaxAge=31536000
api.idleSessionExpirySeconds=172800
api.ingestionPort=
api.ingestionPorts=
api.integratedAuthenticationScheme=
api.listenUris=h t t p : / / l o c a l h o s t : 5005
api.minRequestBodyDataRateBytesPerSecond=240
api.minRequestBodyDataRateGracePeriodMilliseconds=5000
api.redirectHttpToHttps=False
api.webServer=
appHost.executionPolicy=
appHost.installPolicy=
audit.auditPath=
audit.auditServerApiKey=
audit.auditServerUrl=
certificates.certificatesPath=
certificates.defaultPassword=
diagnostics.internalLoggingLevel=Information
diagnostics.internalLogPath=C:\ProgramData\Seq\Logs
diagnostics.internalLogServerApiKey=
diagnostics.internalLogServerUrl=
diagnostics.metricsSamplingIntervalSeconds=300
diagnostics.nativeStorageMetricsSamplingIntervalMinutes=60
diagnostics.telemetryServerUrl=
features.enabled=
firstRun.adminPasswordHash=QLfTt06s...
firstRun.adminUsername=admin
firstRun.requireAuthenticationForHttpIngestion=False
metastore.msSql.connectionString=
metastore.msSql.msiResource=
metastore.msSql.msiTenantId=
metastore.msSql.schema=
metastore.postgres.connectionString=
metastore.postgres.schema=
process.workingSetLimitBytes=
secretKey.provider=
secretKey.providerArgs=
services.servicesBaseUri=
storage.disableFreeDiskSpaceChecking=False
storage.flare.concurrentReaderLimit=
storage.flare.indexerPriority=0
storage.flare.readerParallelismLimit=
storage.maximumFutureTimestampDriftSeconds=3420
storage.secretKey=pmk.AQAAANCMnd8BFdERjHoAwE.....
- Nginx config file:
#user nobody;
worker_processes 1;
error_log logs/error.log;
error_log logs/error.log notice;
error_log logs/error.log info;
#pid logs\\nginx.pid;
events {
worker_connections 1024;
}
http {
include 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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name xx.xx.xx.xx; #my actual vps ip adress here
#charset koi8-r;
access_log logs/host.access.log;
location /seq/ {
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;
rewrite /seq/(.*) /$1 break;
proxy_pass h t t p : / / l o c a l h o s t : :5005;
proxy_read_timeout 90;
}
location /my_app/ {
proxy_pass h t t p : / / l o c a l h o s t : 5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
#proxy_read_timeout 300;
#proxy_connect_timeout 300;
#proxy_send_timeout 300;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}