My ASP local website randomly hangs. ASP pages unable to be loaded. But I can load HTML files just fine - asp-classic

My ASP local website randomly hangs. ASP pages unable to be loaded. But I can load HTML files just fine.
IIS6 is used.
See URL here: http://66.162.173.102/staff/asp/workspace/sos.asp
Above is an ASP page. Sometimes it loads but sometimes the browser keeps on waiting. Sometimes when you click on the link, it might load.
See an HTML page here: http://66.162.173.102/default/services.html
It loads just fine. Only ASP files are not served.
Attaching a part of the httperr.log file in C:\WINDOWS\system32\LogFiles\HTTPERR
#Software: Microsoft HTTP API 1.0
#Version: 1.0
#Date: 2020-04-27 15:00:09
#Fields: date time c-ip c-port s-ip s-port cs-version cs-method cs-uri sc-status s-siteid s-reason s-queuename
2020-04-27 15:00:09 127.0.0.1 1166 127.0.0.1 80 HTTP/1.1 OPTIONS / 400 - Hostname -
2020-04-27 15:02:47 137.97.83.141 54553 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-27 15:10:56 81.30.144.119 63708 192.168.1.100 80 HTTP/0.0 Invalid - 400 - Verb -
2020-04-27 15:11:24 137.97.83.141 54590 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-27 15:35:18 137.97.83.141 54699 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-27 15:35:18 137.97.83.141 54697 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-27 15:35:23 137.97.83.141 54698 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-27 15:46:19 192.168.1.58 56670 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-27 15:46:19 192.168.1.58 56671 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-27 15:46:19 192.168.1.58 56666 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-27 15:46:19 192.168.1.58 56672 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-27 15:46:19 192.168.1.58 56669 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-27 15:46:29 192.168.1.58 56674 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-27 15:54:35 99.170.175.52 54599 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-27 15:54:35 99.170.175.52 54646 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-27 16:09:33 99.170.175.52 56216 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-27 16:23:03 99.170.175.52 56215 192.168.1.100 80 HTTP/1.1 POST /staff/ASP/workspace/workspace.asp?category=&ClientID=&defaultjob=2 - 1 Connection_Dropped DefaultAppPool
2020-04-27 16:55:34 99.170.175.52 60663 192.168.1.100 80 HTTP/1.1 GET /staff/ASP/workspace/neworder/new_job.asp - 1 Connection_Dropped DefaultAppPool
2020-04-27 16:57:04 99.170.175.52 60681 192.168.1.100 80 HTTP/1.1 GET /staff/ASP/workspace/neworder/new_job.asp - 1 Connection_Dropped DefaultAppPool
2020-04-27 17:00:34 99.170.175.52 60707 192.168.1.100 80 HTTP/1.1 GET /staff/ASP/workspace/neworder/new_job.asp - 1 Connection_Dropped DefaultAppPool
2020-04-27 17:02:34 99.170.175.52 61130 192.168.1.100 80 HTTP/1.1 GET /staff/ASP/workspace/neworder/new_job.asp - 1 Connection_Dropped DefaultAppPool
2020-04-27 17:17:33 99.170.175.52 61257 192.168.1.100 80 HTTP/1.1 GET /staff/ASP/workspace/neworder/new_job.asp - 1 Connection_Dropped DefaultAppPool
2020-04-27 17:50:20 189.176.60.218 41042 192.168.1.100 80 HTTP/1.1 GET / 400 - Hostname -
2020-04-27 18:58:47 189.115.113.249 48040 192.168.1.100 80 HTTP/1.1 GET / 400 - Hostname -
2020-04-27 19:16:04 54.81.225.190 33960 192.168.1.100 80 HTTP/1.1 GET /staff/ASP/workspace/current_transmittals_new.asp?JobNo=20-04-0300&FirstID=669711&ids=669711, - 1 Connection_Dropped DefaultAppPool
2020-04-27 21:21:05 99.170.175.52 52333 192.168.1.100 80 HTTP/1.1 GET /staff/ASP/workspace/neworder/new_job.asp - 1 Connection_Dropped DefaultAppPool
2020-04-27 21:27:05 99.170.175.52 52788 192.168.1.100 80 HTTP/1.1 GET /staff/ASP/workspace/neworder/new_job.asp - 1 Connection_Dropped DefaultAppPool
2020-04-28 00:57:56 103.55.139.196 61000 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-28 01:00:41 23.100.232.233 16641 192.168.1.100 80 HTTP/1.1 GET /default/default.asp - 1 Connection_Dropped DefaultAppPool
2020-04-28 01:30:17 66.102.6.233 63969 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-28 01:30:17 66.102.6.235 59498 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-28 01:32:08 35.187.132.12 44364 192.168.1.100 80 - - - - - Timer_ConnectionIdle -
2020-04-28 01:34:11 23.100.232.233 20161 192.168.1.100 80 HTTP/1.1 GET /default/default.asp - 1 Connection_Dropped DefaultAppPool
2020-04-28 03:31:45 23.100.232.233 12609 192.168.1.100 80 HTTP/1.1 GET /default/default.asp - 1 Connection_Dropped DefaultAppPool
The application is running on a Windows Server 2003 Enterprise Edition computer(SP2)
Any help would be appreciated.
EDIT: I just restarted IIS service by going to IIS Manager. And the system came back online. I guess it is crossing some thread/process limits? So by restarting the IIS service, everything in queue gets cleared?
EDIT2: Below is my app pool configuration:
<?xml version ="1.0"?>
<configuration xmlns="urn:microsoft-catalog:XML_Metabase_V64_0">
<MBProperty>
<IIS_Global Location ="."
SessionKey="496353625000000034000000100000000b02000001680000016800009f5eaba7effed08c63e801021b182bbd43808d5113321a82615b9c6c27725f556db0dee91b179f1c69006e0055452cee47c54be335ff611ad70c622c"
>
</IIS_Global>
<IIsApplicationPools Location ="/LM/W3SVC/AppPools"
AdminACL="49634462f0000000a40000004000000064aaed430304663d69e44bf2c8797f525f511bfae0d2c240eb0c25a2e6c3b3d60d1d9639f532969d01d0f77fd3e12e492ae947a0c910333d67eccfd0730449a5b692759f0537e105e1e55d88849a4e2df4c6485ed9790989643380c61b55a3708e3bb6a402aeb050909eb8f4e84cfad18eec3292bbaba7944f092623c8f885fb838b51cd2574205be47ee3a280c8c1597e220277635b06f8dc4146a2d74900c8df329d409beed66795d4d4af8fcd9e9cf9b3acdde6ff756a4dc64b26df45d13e40f513001800000049634862180000001000000000000000c28c1705293ef54d419bcfa4effb5070"
AppPoolIdentityType="2"
AppPoolQueueLength="4000"
CPULimit="0"
CPUResetInterval="5"
DisallowOverlappingRotation="FALSE"
DisallowRotationOnConfigChange="FALSE"
IdleTimeout="20"
LoadBalancerCapabilities="2"
LogEventOnRecycle="AppPoolRecycleTime | AppPoolRecycleMemory | AppPoolRecyclePrivateMemory"
MaxProcesses="1"
OrphanWorkerProcess="FALSE"
PeriodicRestartMemory="0"
PeriodicRestartPrivateMemory="0"
PeriodicRestartRequests="0"
PeriodicRestartTime="1740"
PingInterval="30"
PingResponseTime="90"
PingingEnabled="TRUE"
RapidFailProtection="TRUE"
RapidFailProtectionInterval="5"
RapidFailProtectionMaxCrashes="5"
SMPAffinitized="FALSE"
SMPProcessorAffinityMask="4294967295"
ShutdownTimeLimit="90"
StartupTimeLimit="90"
>
</IIsApplicationPools>
<IIsApplicationPool Location ="/LM/W3SVC/AppPools/DefaultAppPool"
AppPoolAutoStart="TRUE"
IdleTimeout="600"
>
</IIsApplicationPool>
<IIsInheritedProperties Location ="inherited:/LM/W3SVC/AppPools"
AccessFlags="AccessRead | AccessScript"
AllowKeepAlive="TRUE"
AnonymousUserName="IUSR_PLUTUS"
AnonymousUserPass="4963446270000000220000004000000064aaed4320042cbdb6e46cf26a791a52725147fa98d2f440b00c04a287c382d60d1d00000100010045d9052509ef7a46bf20a4f9a0cc19d802000000000000000000000000000000000000000000000001000000000000004c4d454d68000000f067e10100000000"
AppAllowClientDebug="FALSE"
AppAllowDebugging="FALSE"
AppPoolId="DefaultAppPool"
AspAllowOutOfProcComponents="TRUE"
AspAllowSessionState="TRUE"
AspAppServiceFlags="0"
AspBufferingLimit="4194304"
AspBufferingOn="TRUE"
AspCalcLineNumber="TRUE"
AspCodepage="0"
AspDiskTemplateCacheDirectory="%windir%\system32\inetsrv\ASP Compiled Templates"
AspEnableApplicationRestart="TRUE"
AspEnableAspHtmlFallback="FALSE"
AspEnableChunkedEncoding="TRUE"
AspEnableParentPaths="FALSE"
AspEnableTypelibCache="TRUE"
AspErrorsToNTLog="FALSE"
AspExceptionCatchEnable="TRUE"
AspExecuteInMTA="0"
AspKeepSessionIDSecure="0"
AspLCID="2048"
AspLogErrorRequests="TRUE"
AspMaxDiskTemplateCacheFiles="2000"
AspMaxRequestEntityAllowed="4000000"
AspProcessorThreadMax="25"
AspQueueConnectionTestTime="3"
AspQueueTimeout="4294967295"
AspRequestQueueMax="3000"
AspRunOnEndAnonymously="TRUE"
AspScriptEngineCacheMax="250"
AspScriptErrorMessage="An error occurred on the server when processing the URL. Please contact the system administrator."
AspScriptErrorSentToBrowser="TRUE"
AspScriptFileCacheSize="500"
AspScriptLanguage="VBScript"
AspScriptTimeout="200"
AspSessionMax="4294967295"
AspSessionTimeout="600"
AspTrackThreadingModel="FALSE"
AuthChangeURL="/iisadmpwd/achg.asp"
AuthExpiredURL="/iisadmpwd/aexp.asp"
AuthExpiredUnsecureURL="/iisadmpwd/aexp3.asp"
AuthFlags="AuthAnonymous | AuthNTLM"
AuthNotifyPwdExpURL="/iisadmpwd/anot.asp"
AuthNotifyPwdExpUnsecureURL="/iisadmpwd/anot3.asp"
CGITimeout="300"
CacheISAPI="TRUE"
ConnectionTimeout="120"
ContentIndexed="TRUE"
DefaultDoc="Default.htm,Default.asp,index.htm,Default.aspx,index.php"
DirBrowseFlags="DirBrowseShowDate | DirBrowseShowTime | DirBrowseShowSize | DirBrowseShowExtension | DirBrowseShowLongDate | EnableDefaultDoc"
DownlevelAdminInstance="1"
HttpCustomHeaders="X-Powered-By: ASP.NET"
HttpErrors="400,*,FILE,C:\WINDOWS\help\iisHelp\common\400.htm
401,1,FILE,C:\WINDOWS\help\iisHelp\common\401-1.htm
401,2,FILE,C:\WINDOWS\help\iisHelp\common\401-2.htm
401,3,FILE,C:\WINDOWS\help\iisHelp\common\401-3.htm
401,4,FILE,C:\WINDOWS\help\iisHelp\common\401-4.htm
401,5,FILE,C:\WINDOWS\help\iisHelp\common\401-5.htm
401,7,FILE,C:\WINDOWS\help\iisHelp\common\401-1.htm
403,1,FILE,C:\WINDOWS\help\iisHelp\common\403-1.htm
403,2,FILE,C:\WINDOWS\help\iisHelp\common\403-2.htm
403,3,FILE,C:\WINDOWS\help\iisHelp\common\403-3.htm
403,4,FILE,C:\WINDOWS\help\iisHelp\common\403-4.htm
403,5,FILE,C:\WINDOWS\help\iisHelp\common\403-5.htm
403,6,FILE,C:\WINDOWS\help\iisHelp\common\403-6.htm
403,7,FILE,C:\WINDOWS\help\iisHelp\common\403-7.htm
403,8,FILE,C:\WINDOWS\help\iisHelp\common\403-8.htm
403,9,FILE,C:\WINDOWS\help\iisHelp\common\403-9.htm
403,10,FILE,C:\WINDOWS\help\iisHelp\common\403-10.htm
403,11,FILE,C:\WINDOWS\help\iisHelp\common\403-11.htm
403,12,FILE,C:\WINDOWS\help\iisHelp\common\403-12.htm
403,13,FILE,C:\WINDOWS\help\iisHelp\common\403-13.htm
403,15,FILE,C:\WINDOWS\help\iisHelp\common\403-15.htm
403,16,FILE,C:\WINDOWS\help\iisHelp\common\403-16.htm
403,17,FILE,C:\WINDOWS\help\iisHelp\common\403-17.htm
403,18,FILE,C:\WINDOWS\help\iisHelp\common\403.htm
403,19,FILE,C:\WINDOWS\help\iisHelp\common\403.htm
403,20,FILE,C:\WINDOWS\help\iisHelp\common\403-20.htm
404,*,FILE,C:\WINDOWS\help\iisHelp\common\404b.htm
404,2,FILE,C:\WINDOWS\help\iisHelp\common\404b.htm
404,3,FILE,C:\WINDOWS\help\iisHelp\common\404b.htm
405,*,FILE,C:\WINDOWS\help\iisHelp\common\405.htm
406,*,FILE,C:\WINDOWS\help\iisHelp\common\406.htm
407,*,FILE,C:\WINDOWS\help\iisHelp\common\407.htm
412,*,FILE,C:\WINDOWS\help\iisHelp\common\412.htm
414,*,FILE,C:\WINDOWS\help\iisHelp\common\414.htm
415,*,FILE,C:\WINDOWS\help\iisHelp\common\415.htm
500,12,FILE,C:\WINDOWS\help\iisHelp\common\500-12.htm
500,13,FILE,C:\WINDOWS\help\iisHelp\common\500-13.htm
500,15,FILE,C:\WINDOWS\help\iisHelp\common\500-15.htm
500,16,FILE,C:\WINDOWS\help\iisHelp\common\500.htm
500,17,FILE,C:\WINDOWS\help\iisHelp\common\500.htm
500,18,FILE,C:\WINDOWS\help\iisHelp\common\500.htm
500,19,FILE,C:\WINDOWS\help\iisHelp\common\500.htm"
InProcessIsapiApps="C:\WINDOWS\system32\inetsrv\httpext.dll
C:\WINDOWS\system32\inetsrv\httpodbc.dll
C:\WINDOWS\system32\inetsrv\ssinc.dll
C:\WINDOWS\system32\msw3prt.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll"
LogExtFileFlags="LogExtFileDate | LogExtFileTime | LogExtFileClientIp | LogExtFileUserName | LogExtFileServerIp | LogExtFileMethod | LogExtFileUriStem | LogExtFileUriQuery | LogExtFileHttpStatus | LogExtFileWin32Status | LogExtFileServerPort | LogExtFileUserAgent | LogExtFileHttpSubStatus"
LogFileDirectory="C:\WINDOWS\system32\LogFiles"
LogFilePeriod="1"
LogFileTruncateSize="20971520"
LogOdbcDataSource="HTTPLOG"
LogOdbcPassword="4963446260000000120000004000000064aaed43710410bd85e427f2377918525f516f006c0075006d00650031005c00570049004e0044004f00570053005c00730079007300740065006d00330032005c006d006d0063002e0065007800650000009cf400000000"
LogOdbcTableName="InternetLog"
LogOdbcUserName="InternetAdmin"
LogPluginClsid="{FF160663-DE82-11CF-BC0A-00AA006111E0}"
LogType="1"
MaxBandwidth="4294967295"
MaxConnections="4294967295"
MinFileBytesPerSec="240"
PasswordChangeFlags="AuthChangeDisable | AuthAdvNotifyDisable"
ScriptMaps=".asa,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE
.asax,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.ascx,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.ashx,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.asmx,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.asp,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE
.aspx,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.axd,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.cdx,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE
.cer,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE
.config,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.cs,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.csproj,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.idc,C:\WINDOWS\system32\inetsrv\httpodbc.dll,5,GET,POST
.licx,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.php,C:\WINDOWS\system32\inetsrv\fcgiext.dll,5,GET,HEAD,POST
.rem,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.resources,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.resx,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.shtm,C:\WINDOWS\system32\inetsrv\ssinc.dll,5,GET,POST
.shtml,C:\WINDOWS\system32\inetsrv\ssinc.dll,5,GET,POST
.soap,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.stm,C:\WINDOWS\system32\inetsrv\ssinc.dll,5,GET,POST
.vb,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.vbproj,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.vsdisco,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.webinfo,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG"
UNCPassword="4963446250000000060000004000000064aaed4302040000000000006f0074000000640065006600610075006c0074000000630072006f006e005f007300650072007600650072002e00610073007000000061488124324b"
WAMUserName="IWAM_PLUTUS"
WAMUserPass="4963446270000000220000004000000064aaed4348041dbda3e400f26179175278512efaa3d29e40ac0c2ca28dc3fdd60d1d00000100010045d9052509ef7a46bf20a4f9a0cc19d802000000000000000000000000000000000000000000000001000000000000004c4d454d68000000f067e10100000000"
>
</IIsInheritedProperties>
</MBProperty>
</configuration>
EDIT3: I guess it has something to with CPU usage. Is it because of process still not recycled?

Related

Nginx pod responds with its listening port in self-signed certificate examples

Env:
❯ sw_vers
ProductName: macOS
ProductVersion: 11.6.1
BuildVersion: 20G224
❯ minikube version
minikube version: v1.24.0
commit: 76b94fb3c4e8ac5062daf70d60cf03ddcc0a741b
I made a self-signed certificate example on NGINX pod. Omitting to create certificates and keys, since they are working on my local mac, the files are following:
❯ ll rootCA.*
-rw-r--r--# 1 hansuk staff 1383 1 17 12:37 rootCA.crt
-rw------- 1 hansuk staff 1874 1 17 12:02 rootCA.key
❯ ll localhost.*
-rw------- 1 hansuk staff 1704 1 17 12:09 localhost.key
-rw-r--r-- 1 hansuk staff 1383 1 17 12:37 localhost.pem
Start up the following kubernetes definitions on minikube(kubectl apply -f nginx.yml -n cert):
apiVersion: v1
kind: Service
metadata:
name: nginx-cert
labels:
app: nginx-cert
spec:
type: NodePort
ports:
- port: 80
protocol: TCP
name: http
nodePort: 30080
- port: 443
protocol: TCP
name: https
nodePort: 30443
selector:
app: nginx-cert
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
run: nginx-cert
name: nginx-cert
spec:
replicas: 1
selector:
matchLabels:
app: nginx-cert
template:
metadata:
labels:
app: nginx-cert
spec:
volumes:
- name: secret-volume
secret:
secretName: nginxsecret
- name: configmap-volume
configMap:
name: nginxconfmap
containers:
- image: nginx
name: nginx
ports:
- containerPort: 80
- containerPort: 443
volumeMounts:
- mountPath: /etc/nginx/ssl
name: secret-volume
- mountPath: /etc/nginx/conf.d
name: configmap-volume
Create the configmap and secret for nginx config and TLS path respectively:
❯ cat default.conf
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
listen 443 ssl;
root /usr/share/nginx/html;
index index.html;
server_name locahost;
ssl_certificate /etc/nginx/ssl/tls.crt;
ssl_certificate_key /etc/nginx/ssl/tls.key;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
try_files / =404;
}
}
❯ kubectl create configmap nginxconfmap --from-file=default.conf -n cert
❯ kubectl create secret tls nginxsecret --key localhost.key --cert localhost.pem -n cert
All status of deployments and services, and event logs are OK. No failures:
❯ kubectl get all -n cert
NAME READY STATUS RESTARTS AGE
pod/nginx-cert-76f7f8748f-q2nvl 1/1 Running 0 21m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/nginx-cert NodePort 10.110.115.36 <none> 80:30080/TCP,443:30443/TCP 21m
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/nginx-cert 1/1 1 1 21m
NAME DESIRED CURRENT READY AGE
replicaset.apps/nginx-cert-76f7f8748f 1 1 1 21m
❯ kubectl get events -n cert
22m Normal Scheduled pod/nginx-cert-76f7f8748f-q2nvl Successfully assigned cert/nginx-cert-76f7f8748f-q2nvl to minikube
22m Normal Pulling pod/nginx-cert-76f7f8748f-q2nvl Pulling image "nginx"
22m Normal Pulled pod/nginx-cert-76f7f8748f-q2nvl Successfully pulled image "nginx" in 4.345505365s
22m Normal Created pod/nginx-cert-76f7f8748f-q2nvl Created container nginx
22m Normal Started pod/nginx-cert-76f7f8748f-q2nvl Started container nginx
22m Normal SuccessfulCreate replicaset/nginx-cert-76f7f8748f Created pod: nginx-cert-76f7f8748f-q2nvl
22m Normal ScalingReplicaSet deployment/nginx-cert Scaled up replica set nginx-cert-76f7f8748f to
And then, SSL handshaking is working with minukube service IP:
❯ minikube service --url nginx-cert --namespace cert
http://192.168.64.2:30080
http://192.168.64.2:30443
❯ openssl s_client -CAfile rootCA.crt -connect 192.168.64.2:30443 -showcerts 2>/dev/null < /dev/null
CONNECTED(00000003)
---
Certificate chain
0 s:C = KR, ST = Seoul, L = Seocho-gu, O = Localhost, CN = localhost
i:C = KR, ST = RootState, L = RootCity, O = Root Inc., OU = Root CA, CN = Self-signed Root CA
a:PKEY: rsaEncryption, 2048 (bit); sigalg: RSA-SHA256
v:NotBefore: Jan 17 03:37:15 2022 GMT; NotAfter: Jan 17 03:37:15 2023 GMT
-----BEGIN CERTIFICATE-----
MIIDzzCCAregAwIBAgIUYMe6nRgsZwq9UPMKFgj9dt9z9FIwDQYJKoZIhvcNAQEL
BQAweDELMAkGA1UEBhMCS1IxEjAQBgNVBAgMCVJvb3RTdGF0ZTERMA8GA1UEBwwI
Um9vdENpdHkxEjAQBgNVBAoMCVJvb3QgSW5jLjEQMA4GA1UECwwHUm9vdCBDQTEc
MBoGA1UEAwwTU2VsZi1zaWduZWQgUm9vdCBDQTAeFw0yMjAxMTcwMzM3MTVaFw0y
MzAxMTcwMzM3MTVaMFkxCzAJBgNVBAYTAktSMQ4wDAYDVQQIDAVTZW91bDESMBAG
A1UEBwwJU2VvY2hvLWd1MRIwEAYDVQQKDAlMb2NhbGhvc3QxEjAQBgNVBAMMCWxv
Y2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALc9retjBorw
RKbuyC1SNx1U9L5LJPPbBkBh4kg98saQxtRX0Wqs5mgswWMZYL3E6yRl0gfwBkdq
t8GVQ49dgg0QO5MbG9ylfCLS9xR3WWjAgxaDJ0W96PyvTzmg295aqqHFKPSaG/nM
JyZgFJDuGoRRgwoWNqZ1pRCDLMIENDx4qgjOnQch529pM9ZRwFQSswKpn4BVkY00
/u8jIvax67kFOg70QGY16paGEg7YfSNle7BFZY0VJ8rIiBoqwRmPH6hbF/djxe5b
yzkI9eqts9bqw8eDLC28S36x62FxkdqkK8pI/rzWAKSV43TWML1zq4vM2bI+vp0k
a06GhSsS1bUCAwEAAaNwMG4wHwYDVR0jBBgwFoAUURHNpOE9zTgXgVYAGvLt94Ym
P+8wCQYDVR0TBAIwADALBgNVHQ8EBAMCBPAwFAYDVR0RBA0wC4IJbG9jYWxob3N0
MB0GA1UdDgQWBBSS1ZHHT6OHTomYIRsmhz6hMJLGnDANBgkqhkiG9w0BAQsFAAOC
AQEAWA23pCdAXtAbdSRy/p8XURCjUDdhkp3MYA+1gIDeGAQBKNipU/KEo5wO+aVk
AG6FryPZLOiwiP8nYAebUxOAqKG3fNbgT9t95BEGCip7Cxjp96KNYt73Kl/OTPjJ
KZUkHQ7MXN4vc5gmca8q+OqwCCQ/daMkzLabPQWNk3R/Hzo/mT42v8ht9/nVh1Ml
u3Dow5QPp8LESrJABLIRyRs0+Tfp+WodgekgDX5hnkkSk77+oXB49r2tZUeG/CVv
Fg8PuUNi+DWpdxX8fE/gIbSzSsamOf29+0sCIoJEPvk7lEVLt9ca0SoJ7rKn/ai4
HxwTiYo9pNcoLwhH3xdXjvbuGA==
-----END CERTIFICATE-----
---
Server certificate
subject=C = KR, ST = Seoul, L = Seocho-gu, O = Localhost, CN = localhost
issuer=C = KR, ST = RootState, L = RootCity, O = Root Inc., OU = Root CA, CN = Self-signed Root CA
---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA-PSS
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 1620 bytes and written 390 bytes
Verification: OK
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES256-GCM-SHA384
Session-ID: EED06A09B8971ADD25F352BF55298096581A490020C88BB457AB9864B9844778
Session-ID-ctx:
Master-Key: 71C686180017B4DB5D681CCFC2C8741A7A70F7364572811AE548556A1DCAC078ABAF34B9F53885C6177C7024991B98FF
PSK identity: None
PSK identity hint: None
SRP username: None
TLS session ticket lifetime hint: 300 (seconds)
TLS session ticket:
0000 - 8b 7f 76 5a c3 4a 1f 40-43 8e 00 e7 ad 35 ae 24 ..vZ.J.#C....5.$
0010 - 5c 63 0b 0c 91 86 d0 74-ef 39 94 8a 07 fa 96 51 \c.....t.9.....Q
0020 - 58 cd 61 99 7d ae 47 87-7b 36 c1 22 89 fa 8e ca X.a.}.G.{6."....
0030 - 52 c2 04 6e 7a 9f 2d 3e-42 25 fc 1f 87 11 5f 02 R..nz.->B%...._.
0040 - 37 b3 26 d4 1f 10 97 a3-29 e8 d1 37 cd 9a a3 8e 7.&.....)..7....
0050 - 61 52 15 63 89 99 8e a8-95 58 a8 e0 12 03 c4 15 aR.c.....X......
0060 - 95 bf 1e b7 48 dc 4e fb-c4 8c 1a 17 eb 19 88 ca ....H.N.........
0070 - eb 16 b0 17 83 97 04 0d-79 ca d9 7d 80 5b 96 8d ........y..}.[..
0080 - d3 bf 6f 4f 55 6d 2f ce-0b b9 24 a9 a2 d0 5b 28 ..oOUm/...$...[(
0090 - 06 10 1d 72 52 a3 ef f1-5c e3 2a 35 83 93 a1 91 ...rR...\.*5....
00a0 - cb 94 6c 4f 3e f7 2e 8d-87 76 a5 46 29 6f 0e 5f ..lO>....v.F)o._
Start Time: 1643011123
Timeout : 7200 (sec)
Verify return code: 0 (ok)
Extended master secret: yes
---
But it fail to connect on Chrome browser or on curl, redirecting to its listening port each(30080 -> 80, 30443 -> 443):
# for convenience ignore root CA now, the problem is not in there.
❯ curl -k https://192.168.64.2:30443
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.21.5</center>
</body>
</html>
❯ curl -kL https://192.168.64.2:30443
curl: (7) Failed to connect to 192.168.64.2 port 443: Connection refused
❯ curl http://192.168.64.2:30080
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.21.5</center>
</body>
</html>
❯ curl -L http://192.168.64.2:30080
curl: (7) Failed to connect to 192.168.64.2 port 80: Connection refused
❯ kubectl logs nginx-cert-76f7f8748f-q2nvl -n cert
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: can not modify /etc/nginx/conf.d/default.conf (read-only file system?)
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2022/01/24 07:33:25 [notice] 1#1: using the "epoll" event method
2022/01/24 07:33:25 [notice] 1#1: nginx/1.21.5
2022/01/24 07:33:25 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
2022/01/24 07:33:25 [notice] 1#1: OS: Linux 4.19.202
2022/01/24 07:33:25 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2022/01/24 07:33:25 [notice] 1#1: start worker processes
2022/01/24 07:33:25 [notice] 1#1: start worker process 24
2022/01/24 07:33:25 [notice] 1#1: start worker process 25
172.17.0.1 - - [24/Jan/2022:07:44:36 +0000] "\x16\x03\x01\x01$\x01\x00\x01 \x03\x03rM&\xF2\xDD\xA3\x04(\xB0\xB2\xBF\x1CTS`\xDC\x90\x86\xF1\xEC\xBD9\x9Cz1c4\x0B\x8F\x13\xC2" 400 157 "-" "-"
172.17.0.1 - - [24/Jan/2022:07:44:48 +0000] "\x16\x03\x01\x01$\x01\x00\x01 \x03\x03'Y\xECP\x15\xD1\xE6\x1C\xC4\xB1v\xC1\x97\xEE\x04\xEBu\xDE\xF9\x04\x95\xC2V\x14\xB5\x7F\x91\x86V\x8F\x05\x83 \xBFtL\xDB\xF6\xC2\xD8\xD4\x1E]\xAE4\xCA\x03xw\x92D&\x1E\x8D\x97c\xB3,\xFD\xCD\xF47\xC4:\xF8\x00>\x13\x02\x13\x03\x13\x01\xC0,\xC00\x00\x9F\xCC\xA9\xCC\xA8\xCC\xAA\xC0+\xC0/\x00\x9E\xC0$\xC0(\x00k\xC0#\xC0'\x00g\xC0" 400 157 "-" "-"
172.17.0.1 - - [24/Jan/2022:07:45:05 +0000] "\x16\x03\x01\x01$\x01\x00\x01 \x03\x03;J\xA7\xD0\xC2\xC3\x1A\xF9LK\xC7\xA8l\xBD>*\x80A$\xA4\xFCw\x19\xE7(\xFAGc\xF6]\xF3I \xFF\x83\x84I\xC2\x8D\xD5}\xEA\x95\x8F\xDB\x8Cfq\xC6\xBA\xCF\xDDyn\xC6v\xBA\xCC\xDC\xCC\xCC/\xAF\xBC\xB2\x00>\x13\x02\x13\x03\x13\x01\xC0,\xC00\x00\x9F\xCC\xA9\xCC\xA8\xCC\xAA\xC0+\xC0/\x00\x9E\xC0$\xC0(\x00k\xC0#\xC0'\x00g\xC0" 400 157 "-" "-"
172.17.0.1 - - [24/Jan/2022:07:49:08 +0000] "GET / HTTP/1.1" 301 169 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
172.17.0.1 - - [24/Jan/2022:07:49:08 +0000] "GET / HTTP/1.1" 301 169 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
172.17.0.1 - - [24/Jan/2022:08:00:24 +0000] "GET / HTTP/1.1" 400 255 "-" "curl/7.64.1"
172.17.0.1 - - [24/Jan/2022:08:01:46 +0000] "GET / HTTP/1.1" 301 169 "-" "curl/7.64.1"
172.17.0.1 - - [24/Jan/2022:08:01:50 +0000] "GET / HTTP/1.1" 301 169 "-" "curl/7.64.1"
172.17.0.1 - - [24/Jan/2022:08:03:04 +0000] "GET / HTTP/1.1" 301 169 "-" "curl/7.64.1"
172.17.0.1 - - [24/Jan/2022:08:03:07 +0000] "GET / HTTP/1.1" 301 169 "-" "curl/7.64.1"
Actually, at first, the pod respond with the requested ports, 30080 and 30443, but it respond with 80 and 443 now. I have no ideas when it changed and i did change.
I have changed server_name on nginx config from localhost to 192.168.64.2 but it doesn't matter.
I completely recreated your configuration for minikube on Linux. Your Kubernetes configuration is fine. And I got the same response - 301 Moved Permanently.
After that, I changed these lines in the default.conf file:
location / {
try_files $uri $uri/ =404;
}
And everything is working for me now (nginx web page from the pod is reachable using curl and browser).

Upstream http and https protocol under one upstream

I have been trying to add two target under one upstream, one of which is on HTTP and the other one is HTTPS. I am not sure how to acheive that, I tried adding target like: https:10.32.9.123:443 but that didn't work.
It seems like there is a limitation that the targets could either be on HTTP or HTTPS, is there a workaround to this. My kong config file looks like below:
_format_version: "2.1"
_transform: true
services:
- name: test-server-public
protocol: http
host: test-endpoint-upstream
port: 8000
retries: 3
connect_timeout: 5000
routes:
- name: test-route
paths:
- /test
upstreams:
- name: test-endpoint-upstream
targets:
- target: target-url:8080
weight: 999
- target: target-https-url:443
weight: 1
healthchecks:
active:
concurrency: 2
http_path: /
type: http
healthy:
interval: 0
successes: 1
http_statuses:
- 200
- 302
unhealthy:
http_failures: 3
interval: 10
tcp_failures: 3
timeouts: 3
http_statuses:
- 429
- 404
- 500
- 501
- 502
- 503
- 504
- 505
passive:
type: http
healthy:
successes: 1
http_statuses:
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
- 226
- 300
- 301
- 302
- 303
- 304
- 305
- 306
- 307
- 308
unhealthy:
http_failures: 1
tcp_failures: 1
timeouts: 1
http_statuses:
- 429
- 500
- 503
slots: 1000
There're no workaround for that.
You should set to redirect http to https at your webserver configurations.
This http-to-https-redirect plugin will be helpful in your case.

Can't upgrade websocket connection in Kubernetes using Nginx-ingress

I'm trying to connect to my Mosquitto broker over websockets, but I'm not able to do it because the connection doesn't upgrade. The mosquitto broker expose the port 9001 to allow websocket connections and it is running behind a Kubernetes Cluster with nginx-ingress controllers.
$ kubectl get ingress mosquitto
NAME HOSTS ADDRESS PORTS AGE
mosquitto * 80 14m
.
$kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
mosquitto ClusterIP 10.108.206.11 <none> 9001/TCP,1883/TCP 12m
Mosquitto.yaml:
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: mosquitto
spec:
replicas: 1
template:
metadata:
labels:
app: mosquitto
spec:
imagePullSecrets:
- name: abb-login
containers:
- name: mosquitto
image: ***/mosquitto:k8s2
imagePullPolicy: Always
ports:
- containerPort: 9001
protocol: TCP
- containerPort: 1883
protocol: TCP
resources: {}
---
apiVersion: v1
kind: Service
metadata:
name: mosquitto
spec:
ports:
- name: "9001"
port: 9001
targetPort: 9001
protocol: TCP
- name: "1883"
port: 1883
targetPort: 1883
protocol: TCP
selector:
app: mosquitto
Mosquitto.conf:
allow_duplicate_messages false
connection_messages true
log_dest stdout stderr
log_timestamp true
log_type all
persistence false
listener 1883
allow_anonymous true
listener 9001
protocol websockets
allow_anonymous false
auth_plugin /usr/lib/mosquitto-auth-plugin/auth-plugin.so
auth_opt_backends http
auth_opt_http_ip 127.0.0.1
auth_opt_http_getuser_uri /api/mosquitto/users
auth_opt_http_superuser_uri /api/mosquitto/admins
auth_opt_http_aclcheck_uri /api/mosquitto/permissions
auth_opt_acl_cacheseconds 1
auth_opt_auth_cacheseconds 0
Ingress.yaml:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: mosquitto
annotations:
nginx.org/websocket-services: mosquitto
spec:
rules:
- http:
paths:
- path: /mosquitto-ws
backend:
serviceName: mosquitto
servicePort: 80
Error from the client:
MqttException (0) - java.io.IOException: WebSocket Response header: Incorrect upgrade.
opc-ua-adapter_1 | at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:38)
opc-ua-adapter_1 | at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:715)
opc-ua-adapter_1 | at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
opc-ua-adapter_1 | at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
opc-ua-adapter_1 | at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
opc-ua-adapter_1 | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
opc-ua-adapter_1 | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
opc-ua-adapter_1 | at java.base/java.lang.Thread.run(Thread.java:834)
Kubernetes ingress-nginx pod logs:
192.168.39.1 - [192.168.39.1] - - [27/Feb/2019:09:59:14 +0000] "GET /mosquitto-ws HTTP/1.1" 308 171 "-" "-" 218 0.000 [default-mosquitto-9001] - - - - 5db23bb19698ac94612ff6ebac265bed
192.168.39.1 - [192.168.39.1] - - [27/Feb/2019:09:59:14 +0000] "\x88\x84\xDDi+\x5C\xECY\x1Bl" 400 157 "-" "-" 0 0.000 [] - - - - 2b8f177f0f62389ba7d918f9c36ee72e
192.168.39.1 - [192.168.39.1] - - [27/Feb/2019:09:59:14 +0000] "GET /mosquitto-ws HTTP/1.1" 308 171 "-" "-" 218 0.000 [default-mosquitto-9001] - - - - c99fe7606530ae938297e227e34084c0
192.168.39.1 - [192.168.39.1] - - [27/Feb/2019:09:59:14 +0000] "\x88\x84dB5aUr\x05Q" 400 157 "-" "-" 0 0.000 [] - - - - 375ec1ac17cc3e0f7595cf8c1cc752c3
Try to increase proxy-read-timeout and proxy-send-timeout on your mosquito ingress definition.
See the NGinx Ingress doc:
https://kubernetes.github.io/ingress-nginx/user-guide/miscellaneous/#websockets

How to determine the cause of 500 error

I'm using IIS Express and an ASP.NET Core application I made. In my most recent changeset I start getting
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
on the client side. I can'd anything in Event Viewer and the server logs aren't really giving me any useful information either
#Date: 2017-04-08 04:24:20
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2017-04-08 04:24:20 ::1 DEBUG / - 60372 - ::1 - - 200 0 64 19049
2017-04-08 04:24:28 ::1 GET / - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 - 200 0 0 23321
2017-04-08 04:24:30 ::1 GET /js/tutorial.jsx - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 http://localhost:60372/ 404 0 0 2764
2017-04-08 04:24:49 ::1 GET /comments - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 - 200 0 0 341
2017-04-08 04:25:02 ::1 GET / - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 - 200 0 0 580
2017-04-08 04:25:02 ::1 GET /js/tutorial.jsx - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 http://localhost:60372/ 404 0 0 1026
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2017-04-08 04:36:21
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2017-04-08 04:36:21 ::1 DEBUG / - 60372 - ::1 - - 200 0 64 20554
2017-04-08 04:36:30 ::1 GET / - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 - 200 0 0 25434
2017-04-08 04:36:34 ::1 GET /js/tutorial.jsx - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 http://localhost:60372/ 404 0 0 3737
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2017-04-08 04:38:28
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2017-04-08 04:38:28 ::1 DEBUG / - 60372 - ::1 - - 200 0 64 9241
2017-04-08 04:38:38 ::1 GET / - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 - 200 0 0 16824
2017-04-08 04:38:43 ::1 GET /js/tutorial.jsx - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 http://localhost:60372/ 200 0 0 6067
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2017-04-08 04:41:07
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2017-04-08 04:41:07 ::1 DEBUG / - 60372 - ::1 - - 200 0 64 27826
2017-04-08 04:41:20 ::1 GET / - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 - 200 0 0 38678
2017-04-08 04:41:34 ::1 GET /js/tutorial.jsx - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 http://localhost:60372/ 200 0 0 12721
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
I've found that if I comment out the #Url.Content("~/js/tutorial.jsx") from Index.cshtml
#{
Layout = null;
}
<html>
<head>
<title>LRC Archive Dashboard</title>
</head>
<body>
<div id="content"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/remarkable/1.7.1/remarkable.min.js"></script>
<script src="#Url.Content("~/js/tutorial.jsx")"></script>
</body>
</html>
My changeset is https://github.com/jamkin/archivedash/commit/6bde62f9c85d3e8b0e32d1fb83e5737f91050e0e and to me it was working before that.
I've debugged through Startup.cs and through my controller (which does get instantiated when I access the page) and there were no exceptions.
Can someone help point me in the direction of the problem?
As the error "Failed to load resource: the server responded with a status of 500 (Internal Server Error) " is from client side,Were you able to look at the developer toolbar network tab to see what is the detailed error response from server.
In the IIS log you pasted, I do not see 500 response status. Since you are working with localhost(found it from iis log), server should send detailed error response with stack and other details. Hope you have you have enabled add developer exception page in your Configure method as explained here
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
In your client side, You can checkout Developer Toolbar->Network Tab->Click on the 500 Error
.
You can see similar response details in IE/Chrome/Firefox etc

k8s ngnix container return json response

I have a k8s cluster, among other things running an nginx.
when I do curl -v <url> I get
HTTP/1.1 200 OK
< Content-Type: text/html
< Date: Fri, 24 Mar 2017 15:25:27 GMT
< Server: nginx
< Strict-Transport-Security: max-age=15724800; includeSubDomains; preload
< Content-Length: 0
< Connection: keep-alive
<
* Curl_http_done: called premature == 0
* Connection #0 to host <url> left intact
however when I do curl -v <url> -H 'Accept: application/json' I get
< HTTP/1.1 200 OK
< Content-Type: text/html
< Date: Fri, 24 Mar 2017 15:26:10 GMT
< Server: nginx
< Strict-Transport-Security: max-age=15724800; includeSubDomains; preload
< Content-Length: 0
< Connection: keep-alive
<
* Curl_http_done: called premature == 0
* Connection #0 to host <url> left intact
* Could not resolve host: application
* Closing connection 1
curl: (6) Could not resolve host: application
My task is to get the request to return a json not html.
To my understanding I have to create an ingress-controller and modify the ngnix.conf somehow, I've been trying for a few days now but can't get it right. Any kind of help would be most appreciated.
The following are of the yaml files I've been using:
configmap:
apiVersion: v1
data:
server-tokens: "false"
proxy-body-size: "4110m"
server-name-hash-bucket-size: "128"
kind: ConfigMap
metadata:
name: nginx-load-balancer-conf
labels:
app: nginx-ingress-lb
daemonset:
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: nginx-ingress-lb
labels:
app: nginx-ingress-lb
spec:
template:
metadata:
labels:
name: nginx-ingress-lb
app: nginx-ingress-lb
spec:
terminationGracePeriodSeconds: 60
nodeSelector:
NodeType: worker
containers:
- image: gcr.io/google_containers/nginx-ingress-controller:0.9.0-beta.1
name: nginx-ingress-lb
imagePullPolicy: Always
readinessProbe:
httpGet:
path: /healthz
port: 10254
scheme: HTTP
livenessProbe:
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 1
# use downward API
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
ports:
- containerPort: 80
hostPort: 80
- containerPort: 443
hostPort: 443
args:
- /nginx-ingress-controller
- --default-backend-service=$(POD_NAMESPACE)/default-http-backend
- --configmap=$(POD_NAMESPACE)/nginx-load-balancer-conf
deployment:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: default-http-backend
labels:
app: default-http-backend
spec:
replicas: 2
template:
metadata:
labels:
app: default-http-backend
spec:
terminationGracePeriodSeconds: 60
containers:
- name: default-http-backend
# Any image is permissable as long as:
# 1. It serves a 404 page at /
# 2. It serves 200 on a /healthz endpoint
image: gcr.io/google_containers/defaultbackend:1.2
livenessProbe:
httpGet:
path: /healthz
port: 8080
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 5
ports:
- containerPort: 8080
resources:
limits:
cpu: 100m
memory: 20Mi
requests:
cpu: 100m
memory: 20Mi
service:
apiVersion: v1
kind: Service
metadata:
name: default-http-backend
labels:
app: default-http-backend
spec:
selector:
app: default-http-backend
ports:
- port: 80
targetPort: 8080
Remove the space after colon in curl -v <url> -H 'Accept: application/json'
The error message Could not resolve host: application means that it's taking application/json as the URL, instead of a header.
There are two things:
Exposing your app
Making your app return json
The ingess is only relevant to expose your app. And that is not the only option, you can use service (type Load balancer, for example) to achieve that too on most cloud providers. So, I'd keep it simple and not use ingress for now, until you solve the second problem.
As it has been explained, your curl has a syntax problem and that's why it shows curl: (6) Could not resolve host: application.
The other thing is fixing that won't make your app return json. And this is because you are only saying you accept json with that header. But if you want your app to return json, then you need to write it on your app. nginx can't guess how you want to map your HTML to json. There is much no other way than writting it, at least that I know of :-/

Resources