Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need custom snippet inside nginx.conf #600

Open
basi01 opened this issue Jan 19, 2023 · 0 comments
Open

Need custom snippet inside nginx.conf #600

basi01 opened this issue Jan 19, 2023 · 0 comments

Comments

@basi01
Copy link
Contributor

basi01 commented Jan 19, 2023

Hi.
We need to include a custom code snippet inside nginx.conf. The rules are:
if X-Forwarded-For is present and if X-Forwarded-Proto is not https or missing then send 307 redirect to HTTPS

Does buildpack support that?

    server {
        listen 8080;
        server_name _;
        root /home/vcap/app/web/;
        index index.html index.htm;

        error_page 403 @403-custom;
        error_page 404 @404-custom;
        error_page 503 @503-custom;

set $my_insecure_forwarded 1;

if ($http_x_forwarded_for = '') {
    set $my_insecure_forwarded 0;
}

if ($http_x_forwarded_proto = 'https') {
    set $my_insecure_forwarded 0;
}

if ($my_insecure_forwarded) {
    return 307 https://$host$request_uri;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant