[ Question ] Reverse proxy domain path to cloud function or AWS Lambda service? #375
-
I would like to proxy a location on my host https://someurl.com/consumer -> https://project_id.cloudfunctions.net In a non-docker setup I would write something like so in a someurl_com.conf file:
I am trying to figure out what I would put in the compose.yml file to cause the proper configuration to be generated by nginx.tmpl but things get weird, docker requires each service to have an image. Is there best practice method to work around this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello @Borillion, Thanks for your message. Let me see if I got this right. You have the scenario below: Container 1 with:
Container 2 with:
And you want the container 1 to forward the location '/consumer' to container 2 as of: https://someurl.com/consumer -> https://project_id.cloudfunctions.net/ If you would be using microservices and have one container to respond for 'someurl.com/consumer ' by itself (not two domains), I would suggest you to override the location as of: Place a files called 'someurl.com_location_override' to the 'vhost.d' folder, which should match the 'NGINX_FILES_PATH/data/vhost.d' with the content: location /consumer {
proxy_pass http://project_id.cloudfunctions.net/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# underscores_in_headers on;
# proxy_set_header proxy_ssl_server_name $host;
}
location / {
proxy_pass http://someurl.com;
}
Hope it helps! |
Beta Was this translation helpful? Give feedback.
Hello @Borillion,
Thanks for your message.
Let me see if I got this right. You have the scenario below:
Container 1 with:
Container 2 with:
And you want the container 1 to forward the location '/consumer' to container 2 as of:
https://someurl.com/consumer -> https://project_id.cloudfunctions.net/
If you would be using microservices and have one container to respond for 'someurl.com/consumer ' by itself (not two domains),
you could use path based routing which works perfectly for that. But in this case might mix the 'VIRTUAL_PATH' as you have two domains, did not really tested this...
I would suggest you to o…