how to install nginx_substitutions_filter in existing Nginx

Francis Daly francis at daoine.org
Wed Jun 21 22:09:48 UTC 2017


On Sun, Jun 18, 2017 at 09:59:43PM -0400, David Woodstuck wrote:

Hi there,

> I have a host Nginx server running in port: 9000, This Nginx will proxy
> http://www.myserver.com:10085/. Some pages from
> http://www.myserver.com:10085/ have a lot of iframes whose srcs are
> http://www.myserver.com:10088/ and http://www.myserver.com:10089/. I cannot
> get access to http://www.myserver.com:10085/, http://www.myserver.com:10088/
> and http://www.myserver.com:10089/. I want the pages from
> http://www.myserver.com:10085/ to have CORS( add_header
> 'Access-Control-Allow-Origin' '*').  How do I achieve this?

You have nginx on port 9000 which does "proxy_pass http://www.myserver.com:10085;".

You want responses from the upstream port 10085 to include this extra header.

Put "add_header Access-Control-Allow-Origin *;" in the same location{}
as the proxy_pass.

You can test, using something like "curl -v", to confirm that the response
to a request to port 9000 does not refer to port 10085 at all, and that
it includes the extra header.

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list