Tag Info

Hot answers tagged

3

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


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 ...


1

My first thought would be to use a map. map $arg_param $cache_valid_404 { "" 2d; 1 15m; } Then you set: proxy_cache_valid 404 $cache_valid_404;


1

I found this by chance - because Serverfault showed to me all the reverse proxy questions in the sidebar: http://serverfault.com/a/142961/129177 The solution seems to be: ProxyPass /site http://10.1.1.8/backend retry=0 ProxyPassReverse /site http://10.1.1.8/backend


1

Fixed Apache directive. Wrong directive: RequestHeader set X_FORWARDED_PROTO 'https' Correct directive: RequestHeader set X-FORWARDED-PROTO 'https' I originally took it from the http://www.redmine.org/projects/redmine/wiki/FAQ#Why-does-Redmine-use-http-links-when-I-want-it-to-use-https-links-in-Apache-SSL and then copied in my Apache config file. I ...


1

Right now any and all requests are going to hit this server block: server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; server_name _; # This doesn't do anything rewrite ^ $scheme://www.example.com$request_uri permanent; # Rest of file irrelevant } Because: no server block has a valid server_name ...


1

OK figured it out, I thought the "not found" error was coming from nginx, but actually it was coming from my API. This is my solution if anyone is interested: server { listen 80; server_name localhost; server_name 192.168.3.90; server_name 127.0.0.1; location / { root /home/me/src/phoenix/ui; index index.html; } # automatically go to ...


1

After a lot of research I found the solution. In "inner" nginx configuration: http { ... map $http_x_forwarded_proto $context { https on; default off; } ... server { ... location ~ \.php$ { ... fastcgi_param HTTPS $context; ... } } } References: this hint on the nginx mailing ...


1

- How do I set custom variables based on regexp against a useragent? Use a map. For instance : map $http_user_agent $my_var { default "default_value"; "~^foo$" "value_1"; "~^bar$" "value_2"; } - How do I set custom headers for the reverse-proxy request? Use proxy_set_header. For example : proxy_set_header My-Header $my_var; - ...


1

Noting that SSL seemed to work with other domains on the same server, I added more SSL configuration directives. This one: ssl_session_cache shared:SSL:10m; cured the segfaults. I believe this ticket is the underlying issue; nginx blames OpenSSL. The effective nginx-level fix (and what I'm doing now that I know what's up) is to do your nginx-wide SSL ...


1

It could be the problem is with the Apache backends having a problem resolving the proxy server. If this is the case you can fix it by either hardcoding the details for the proxy server in each of the /etc/hosts file, ie by adding a line like proxy.ip.addr www.example.com example.com Or by turning off reverse DNS lookups in Apache using the ...


1

You can use seperate Location containers for the images. I am not testing this but this should be more or less it. For /c: <Location /c/images_v3> ProxyPass http://1.1.1.3/images_v3 ProxyPassReverse http://1.1.1.3/images_v3 </Location> <Location /c> ProxyPass ...


1

At this point when you will receive a 302 status from your rubygems backend, you have to make a request again at the new location specify by the HTTP header Location in the response. You should end up with something like that: vcl_fetch { if (beresp.status == 302) { /* The content is on another location */ /* First change the host of the ...


1

In some website, if you switch from HTTP to HTTPS version, you should inform the the website configuration like 'Hey, we are served through HTTPS now'. Well, the reason is some website has hard-coded configuration to their static file URL generator. So, even they are served through HTTPS, the static-resources-URL generator still thinks that we are talking ...


1

Your proxy_pass directives should all have trailing slashes, for example, from your default configuration (amended); server { listen 80 default; server_name _; server_name_in_redirect off; server_tokens off; access_log /var/log/nginx/default.access.log; error_log /var/log/nginx/default.error.log; location / { ...



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