Tag Info

Hot answers tagged

16

Use Rewrite conditions to match for this special case: RewriteEngine On RewriteCond %{REQUEST_URI} ^/socket.io [NC] RewriteCond %{QUERY_STRING} transport=websocket [NC] RewriteRule /(.*) ws://localhost:8082/$1 [P,L] ProxyPass /socket.io http://localhost:8082/socket.io ProxyPassReverse /socket.io ...


5

You express configured to serve path /index.html, but you requires /test-express/index.html. Either configure express to serve /test-express/index.html or make nginx to strip /test-exress from proxied request. Latter is as simple as add trailing slashes to location and proxy_pass. location /test-express/ { proxy_pass http://127.0.0.1:3002/; } See ...


5

Came across the same issue with Server version: Apache/2.4.6 As per the documentation at [1], "In 2.4.5 and later, SSLProxyCheckPeerCN has been superseded by SSLProxyCheckPeerName, and its setting is only taken into account when SSLProxyCheckPeerName off is specified at the same time." So adding following entry did the trick: SSLProxyCheckPeerName off So ...


5

This IS possible with Haproxy. You can setup a TCP proxy and extract the SNI and do routing based on the SNI. Here's an example: backend be.app1 mode tcp no option checkcache no option httpclose tcp-request inspect-delay 5s tcp-request content accept if { req.ssl_hello_type 1 } tcp-request content reject use-server server1 if { ...


4

You don't need rewrite for this. server { ... location ^~ /api/ { proxy_pass http://localhost:7379/; } location ^~ /api/mypath/ { proxy_pass http://localhost:3936/v1/; } }


4

There's an apache module called mod_substitute that can do this. Here's a short example: <Location "/"> AddOutputFilterByType SUBSTITUTE text/html Substitute "s/uat.site.co.jp/jp.uat.site2uk.co.uk/ni" </Location> Or, when combined with mod_proxy: ProxyPass / http://uat.site.co.jp/ ProxyPassReverse / http://uat.site.co.jp/ Substitute ...


3

Nginx is being stopped from binding to SELinux pop_port_t ports. It possible is to alter the desired ports to be a type that nginx can bind to, e.g. http_port_t. # for port in {143,993,110,995} ; do semanage port -m -t http_port_t -p tcp $port ; done && semanage port -l -C SELinux Port Type Proto Port Number http_port_t ...


3

The Via header is designed for passing the blame on to someone else. It is perfectly acceptable to remove, or not generate it, if it doesn't serve that purpose.


3

"Server not found" from a browser often indicates a failure to resolve the host-name into an IP address. I notice that ubnt.aqtsolutions.com does not resolve, but the other two names do. It may be that your nginx configuration is fine and you just have a missing DNS entry.


3

Because you regex doesn't match. ^[A-Za-z0-9]$ matches URIs composed of one alphanumeric character and you didn't put any leading slash nor capture group. You need ProxyPassMatch ^/([A-Za-z0-9]+)$ https://example1.com/news-$1 instead.


3

Cloudflare has these ip ranges, you can use nginx built-in real_ip module and setup headers properly https://www.cloudflare.com/ips set_real_ip_from 204.93.240.0/24; real_ip_header CF-Connecting-IP; https://support.cloudflare.com/hc/en-us/articles/200170706-Does-CloudFlare-have-an-IP-module-for-Nginx-


3

If you haven't restarted Apache, be sure to do that, but if you've already done so, you could try a global output filter that runs a custom PHP script to do your replacing just to see if that solves it for some reason. EDIT: based on your comment, it could be that substitute isn't working because the content is compressed. To turn off compression, add ...


3

Edit: (1) Sorry, some typo here (2) I adjust regex so it matches one or more slash before string mybucket like your log above. Well, maybe you mean something like this location ~* ^/https://s3\.amazonaws\.com/+mybucket(.*) { ... proxy_pass http://s3.amazonaws.com/mybucket$1; }


3

Apache would see the IP address 192.168.0.123 as the source and that needs to be added the RPAF_proxyips directive, this tells mod_rpaf that its a known proxy. Quoting from http://www.stderr.net/apache/rpaf/ It changes the remote address of the client visible to other Apache modules when two conditions are satisfied. First condition is that the remote ...


3

To start, I would set up Nginx as a reverse proxy to the third-party server. You can read about how that works here: http://nginx.com/resources/admin-guide/reverse-proxy/, an example setup might look like: server { listen 80; server_name example-proxy-domain.com; location /some/path/ { proxy_pass ...


3

Yes, Squid will cache the reponses from the back-end server(s) using the conventional method of interpreting the headers the back-end server sends with each response. A typical response for dynamic contents that shouldn't be cached looks something like: Expires: Fri Jul 25 10:19:36 CEST 2014 GMT Cache-Control: max-age=0, no-cache, no-store Pragma: ...


2

You're not missing anything; you configured nginx correctly. The problem here is that WordPress thinks it should be generating HTTP links. When you try to access it via HTTPS, it still generates all of its links with http:// and thus they can't be loaded (without explicitly loading insecure content in the browser). There are WordPress plugins that will ...


2

Your approach is flawed. You do not want to use the domain names when configuring iptables. Your firewall has no notion of which domain a client has resolved to reach your hostsystem. All it sees are the IP address and port number. If you want to make the containers reachable via a public IP, you need to choose a distinct IP that is available on the ...


2

It's not IP as in IP address, but IP as in instruction pointer. You've encountered a bug in nginx. Consider upgrading, if you are running an outdated version. You could also file a bug report if you can tell what happened immediately before the segfault (check the rest of the log) or have a coredump (as long as there is nothing confidential on the ...


2

I have been searching for a solution for this problem on and off for the last 16 months. But each time I look, it seems impossible to do this with the SSH protocol as specified in relevant RFCs and implemented by major implementations. However if you are willing to use a slightly modified SSH client and you are willing to utilize protocols in way that was ...


2

It has been 3 years since this question was asked and a lot has changed. This answer is to help anyone like me. The current version of nginx allows to create multiple sub filter rules under one location directive. Like so location / { resolver 8.8.8.8; proxy_pass http://original-domain.com; proxy_set_header Accept-Encoding ""; proxy_set_header ...


2

You can just use the stunnel service in client mode to listen for unencrypted traffic at localhost and then pass it on to the SSL backend. Example configuration: [gmail-pop3] client = yes accept = 127.0.0.1:1110 connect = pop.gmail.com:995 Then point nginx to localhost:1110 as backend and it will in fact connect to GMail's POP3 server over SSL.


2

I have another way to achieve this, If you have have several things to upgrade on each server. That'll be very wasting to update 5 server for the same operations. Create a Load Balancing & Scaling Group.Ensure the connection draining is enabled. There's my upgrade step. Remove 1 instance from your load balancer. Update everything you need. And ...


2

You'll need to clarify what you're trying to achieve. With a reverse proxy, the user connects to only the abc123.com server. When they request something within /blog, the abc123.com server makes a connection to the abc123blog.com server, makes a request, gets a response, then feeds that response back to the user. If you're trying to encrypt the user's ...


2

The issue is that when you use a trailing slash with the proxy_pass directive, the default behaviour for proxy_redirect is that the following : location /test/ { proxy_pass http://192.168.1.202/; proxy_set_header Host $host; } Is the same as : location /test/ { proxy_pass http://192.168.1.202/; proxy_redirect http://192.168.1.202/ /test/; ...


2

Both location directives need to be in the same vhost configuration. Different vhosts are meant to allow different host names and/or protocols to be served by the same server. What you have done effectively is to create two vhosts, but without a means to differentiate the two, e.g. with the server_name directive. Since it can't differentiate them, nginx ...


2

Turned out not to be a problem with the nginx conf - that was fine. The problem is due to the fact that Chrome only allows setting of cookies from fully-qualified domain names, not for IP addresses https://code.google.com/p/chromium/issues/detail?id=56211 I bought a domain name, applied it to my server, and it worked. It required one change to the nginx ...


2

You can't do this with mod_rewrite, as that is only for requests. Further, operating on Location is not a 100% solution (that it would be pretty high), as it won't capture things like HTTP meta-refresh (not very common these days...), or instances where the URL is generated using client-side solutions (eg. Javascript, embedded content). Thus, the desire ...


2

After some digging, I found something similar that just nails it. I found obscure tutorials, even bad links on the Apache doc section. So, for everyone who really doesn't care about Apache ins-and-outs, but just wants their Rails apps to fly with reverse proxy on the Bitnami Rubystack. Include the vhosts in the main configuration file (httpd-conf) Add your ...


2

Identifying the type of request and forwarding it based on that cannot be done at the TCP level. By the time your gateway need to decide which host to NAT it to, the request has not been sent yet. On the application layer, you have more possibilities. This will be protocol dependent and is only possible for some protocols. An HTTP proxy is one example doing ...



Only top voted, non community-wiki answers of a minimum length are eligible