SignalR in ASP.NET Core behind Nginx

I was able to solve this by using $http_connection instead of keep-alive or upgrade server { server_name example.com; location / { proxy_pass http://localhost:5000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } } I did this because SignalR was also trying to use POST and GET requests to my hubs, … Read more

How to log real client ip in rails log when behind proxy like nginx

In my opinion, your current approach is the only sane one. The only step that is missing is overwriting the IP address in env. The typical REMOTE_ADDR seldom holds the correct IP if you’ve any amount of layers of proxies and load balancers and what not — you’re not unique in this respect. Each potentially … Read more

ActiveRecord::ConnectionTimeoutError: could not obtain a database connection within 5.000 seconds (waited 5.000 seconds)

I had the same problems which were caused by too many open connections to the database. This can happen when you have database queries outside of a controller (in a model, mailer, pdf generator, …). I could fix it by wrapping those queries in this block which closes the connection automatically. ActiveRecord::Base.connection_pool.with_connection do # your … Read more

How i can translate uppercase to lowercase letters in a rewrite rule in nginx web server?

Yes, you are going to need perl. If you are using Ubuntu, instead of apt-get install nginx-full, use apt-get install nginx-extras, which will have the embedded perl module. Then, in your configuration file: http { … # Include the perl module perl_modules perl/lib; … # Define this function perl_set $uri_lowercase ‘sub { my $r = … Read more

Kubernetes Nginx Ingress not finding service endpoint

I discovered what I was doing wrong. In my application definition I was using name as my selector selector: matchLabels: name: hello-world template: metadata: labels: name: hello-world Whereas in my service I was using app selector: app: hello-world After updating my service to use app, it worked selector: matchLabels: app: hello-world template: metadata: labels: app: … Read more

Let’s Encrypt kubernetes Ingress Controller issuing Fake Certificate

Maybe would be helpful for someone experiencing similar issues. As for me, a forgot to specify hostname in Ingress yaml file for both rules and tls sections. After duplicating the hostname, it started responding with a proper certificate. Example: apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: test-web-ingress annotations: kubernetes.io/ingress.class: nginx spec: tls: – hosts: – my.host.com … Read more

how to serve html files in nginx without showing the extension in this alias setup

Apparently alias and try_files don’t work together. However, I don’t think you need to use alias. location /mr { default_type “text/html”; try_files /fullpath/$uri /fullpath/$uri.html /fullpath/$uri/index.html /fullpath/index.html; } Which would try: Exact file. File with .html added. Index in the path. Default index. I think the root directive does work with try files but am unable … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)