Serve devpi on a location other than /, nginx
Hi, I am trying to configure nginx to serve devpi on https://<myhost>/devpi/. The generated nginx configuration works fine on https://<myhost>. But since we are in a restricted network environment, all services have to share one nginx server instance. My current simplified configuration looks as follows: location /devpi/ { root /data/devpi/; proxy_pass http://localhost:4040; proxy_set_header X-outside-url $scheme://$host:$server_port; proxy_set_header X-Real-IP $remote_addr; expires -1; # no-cache } But I get infinite redirection from this configuration. Can you help me? Thanks! Best regards, Feischi
Hi! You need to add the path to the X-Outside-Url header: proxy_set_header X-outside-url $scheme://$host:$server_port/devpi; You might also have to rewrite the request URI, to remove the leading /devpi, not sure about that anymore. Regards, Florian Schulze On 20 May 2016, at 13:38, Feischi wrote:
Hi,
I am trying to configure nginx to serve devpi on https://<myhost>/devpi/.
The generated nginx configuration works fine on https://<myhost>. But since we are in a restricted network environment, all services have to share one nginx server instance.
My current simplified configuration looks as follows:
location /devpi/ { root /data/devpi/; proxy_pass http://localhost:4040; proxy_set_header X-outside-url $scheme://$host:$server_port; proxy_set_header X-Real-IP $remote_addr; expires -1; # no-cache }
But I get infinite redirection from this configuration.
Can you help me? Thanks!
Best regards, Feischi
-- You received this message because you are subscribed to the Google Groups "devpi-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to devpi-dev+...@googlegroups.com. To post to this group, send email to devp...@googlegroups.com. Visit this group at https://groups.google.com/group/devpi-dev. For more options, visit https://groups.google.com/d/optout.
Hi Florian, Can you elaborate a bit on the "rewrite request URI" part? I think I am getting there. With "proxy_set_header X-outside-url $scheme://$host:$server_port/devpi;" I get the following error: The following resource could not be found: The stage devpi/devpi could not be found. Thanks a lot. Best regards, Feischi On Friday, May 20, 2016 at 1:52:45 PM UTC+2, Florian Schulze wrote:
Hi!
You need to add the path to the X-Outside-Url header:
proxy_set_header X-outside-url $scheme://$host:$server_port/devpi;
You might also have to rewrite the request URI, to remove the leading /devpi, not sure about that anymore.
Regards, Florian Schulze
On 20 May 2016, at 13:38, Feischi wrote:
Hi,
I am trying to configure nginx to serve devpi on https://<myhost>/devpi/.
The generated nginx configuration works fine on https://<myhost>. But since we are in a restricted network environment, all services have to share one nginx server instance.
My current simplified configuration looks as follows:
location /devpi/ { root /data/devpi/; proxy_pass http://localhost:4040; proxy_set_header X-outside-url $scheme://$host:$server_port; proxy_set_header X-Real-IP $remote_addr; expires -1; # no-cache }
But I get infinite redirection from this configuration.
Can you help me? Thanks!
Best regards, Feischi
-- You received this message because you are subscribed to the Google Groups "devpi-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to devpi-...@googlegroups.com <javascript:>. To post to this group, send email to dev...@googlegroups.com <javascript:>. Visit this group at https://groups.google.com/group/devpi-dev. For more options, visit https://groups.google.com/d/optout.
Something like this (untested): location /devpi/ { rewrite ^/devpi(.*)$ $1 break; root /data/devpi/; proxy_pass http://localhost:4040; proxy_set_header X-outside-url $scheme://$host:$server_port/devpi; proxy_set_header X-Real-IP $remote_addr; expires -1; # no-cache } I had this setup myself at some point for testing the functionality with devpi, but can't find it anymore. Regards, Florian Schulze On 20 May 2016, at 14:18, Feischi wrote:
Hi Florian,
Can you elaborate a bit on the "rewrite request URI" part? I think I am getting there.
With "proxy_set_header X-outside-url $scheme://$host:$server_port/devpi;" I get the following error:
The following resource could not be found:
The stage devpi/devpi could not be found.
Thanks a lot.
Best regards, Feischi
On Friday, May 20, 2016 at 1:52:45 PM UTC+2, Florian Schulze wrote:
Hi!
You need to add the path to the X-Outside-Url header:
proxy_set_header X-outside-url $scheme://$host:$server_port/devpi;
You might also have to rewrite the request URI, to remove the leading /devpi, not sure about that anymore.
Regards, Florian Schulze
On 20 May 2016, at 13:38, Feischi wrote:
Hi,
I am trying to configure nginx to serve devpi on https://<myhost>/devpi/.
The generated nginx configuration works fine on https://<myhost>. But since we are in a restricted network environment, all services have to share one nginx server instance.
My current simplified configuration looks as follows:
location /devpi/ { root /data/devpi/; proxy_pass http://localhost:4040; proxy_set_header X-outside-url $scheme://$host:$server_port; proxy_set_header X-Real-IP $remote_addr; expires -1; # no-cache }
But I get infinite redirection from this configuration.
Can you help me? Thanks!
Best regards, Feischi
-- You received this message because you are subscribed to the Google Groups "devpi-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to devpi-...@googlegroups.com <javascript:>. To post to this group, send email to dev...@googlegroups.com <javascript:>. Visit this group at https://groups.google.com/group/devpi-dev. For more options, visit https://groups.google.com/d/optout.
-- You received this message because you are subscribed to the Google Groups "devpi-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to devpi-dev+...@googlegroups.com. To post to this group, send email to devp...@googlegroups.com. Visit this group at https://groups.google.com/group/devpi-dev. For more options, visit https://groups.google.com/d/optout.
It works. Thanks! Danke vielmals! On Friday, May 20, 2016 at 2:42:22 PM UTC+2, Florian Schulze wrote:
Something like this (untested):
location /devpi/ { rewrite ^/devpi(.*)$ $1 break; root /data/devpi/; proxy_pass http://localhost:4040; proxy_set_header X-outside-url $scheme://$host:$server_port/devpi; proxy_set_header X-Real-IP $remote_addr; expires -1; # no-cache }
I had this setup myself at some point for testing the functionality with devpi, but can't find it anymore.
Regards, Florian Schulze
On 20 May 2016, at 14:18, Feischi wrote:
Hi Florian,
Can you elaborate a bit on the "rewrite request URI" part? I think I am getting there.
With "proxy_set_header X-outside-url $scheme://$host:$server_port/devpi;" I get the following error:
The following resource could not be found:
The stage devpi/devpi could not be found.
Thanks a lot.
Best regards, Feischi
On Friday, May 20, 2016 at 1:52:45 PM UTC+2, Florian Schulze wrote:
Hi!
You need to add the path to the X-Outside-Url header:
proxy_set_header X-outside-url $scheme://$host:$server_port/devpi;
You might also have to rewrite the request URI, to remove the leading /devpi, not sure about that anymore.
Regards, Florian Schulze
On 20 May 2016, at 13:38, Feischi wrote:
Hi,
I am trying to configure nginx to serve devpi on https://<myhost>/devpi/.
The generated nginx configuration works fine on https://<myhost>. But since we are in a restricted network environment, all services have to share one nginx server instance.
My current simplified configuration looks as follows:
location /devpi/ { root /data/devpi/; proxy_pass http://localhost:4040; proxy_set_header X-outside-url $scheme://$host:$server_port; proxy_set_header X-Real-IP $remote_addr; expires -1; # no-cache }
But I get infinite redirection from this configuration.
Can you help me? Thanks!
Best regards, Feischi
-- You received this message because you are subscribed to the Google Groups "devpi-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to devpi-...@googlegroups.com <javascript:>. To post to this group, send email to dev...@googlegroups.com <javascript:>. Visit this group at https://groups.google.com/group/devpi-dev. For more options, visit https://groups.google.com/d/optout.
-- You received this message because you are subscribed to the Google Groups "devpi-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to devpi-...@googlegroups.com <javascript:>. To post to this group, send email to dev...@googlegroups.com <javascript:>. Visit this group at https://groups.google.com/group/devpi-dev. For more options, visit https://groups.google.com/d/optout.
participants (2)
-
Feischi
-
Florian Schulze