Skip to content

Issue parsing variables inside include directives #105

@AtmosphericIgnition

Description

@AtmosphericIgnition

A part of my NGINX config has inline HTML as responses for error pages:

error_page 500 502 503 504 /50x.html;
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 421 422 423 424 425 426 428 429 431 451 494 495 496 497 /40x.html;

location = /50x.html {
	root /srv/server-pages/html;
	internal;
	default_type text/html;
	return 200 "<!DOCTYPE html>
    <html>
    <head>
        <title>Server Error</title>
        <style>
            html {
                color-scheme: light dark;
            }
            body {
                display: flex;
                flex-direction: column; /* Stack elements vertically */
                justify-content: center;
                align-items: center;
                height: 100vh; /* Full viewport height */
                margin: 0;
                font-family: Tahoma, Verdana, Arial, sans-serif;
                text-align: center; /* Center text */
            }
            h1 {
                margin: 0;
            }
            h2 {
                margin: 0.5em 0;
            }
        </style>
    </head>
    <body>
        <h1>Server error: HTTP <span style='color: #c0392b;'>$status</span></h1>
        <h2><span style='color: #c0392b;'>$error_code</span></h2>
        <p>The page you are looking for is currently unavailable.<br/></p>
        <p>This error indicates a problem with the server's response to requests.</p>
        <p>If this is unexpected, contact the system administrator with your request ID: $request_id</p>
    </body>
    </html>";
}

location = /40x.html {
	root /srv/server-pages/html;
	internal;
	default_type text/html;
	return 200 "<!DOCTYPE html>
    <html>
    <head>
        <title>Client Error</title>
        <style>
            html {
                color-scheme: light dark;
            }
            body {
                display: flex;
                flex-direction: column; /* Stack elements vertically */
                justify-content: center;
                align-items: center;
                height: 100vh; /* Full viewport height */
                margin: 0;
                font-family: Tahoma, Verdana, Arial, sans-serif;
                text-align: center; /* Center text */
            }
            h1 {
                margin: 0;
            }
            h2 {
                margin: 0.5em 0;
            }
        </style>
    </head>
    <body>
        <h1>Client error: HTTP <span style='color: #c0392b;'>$status</span></h1>
        <h2><span style='color: #c0392b;'>$error_code</span></h2>
        <p>The server could not process your request.<br/></p>
        <p>This error indicates a problem with your browser or client, and the request it made.</p>
        <p>If this is unexpected, contact the system administrator with your request ID: $request_id</p>
    </body>
    </html>";
}

Gixy will print [variable] INFO Can't find variable 'error_code' in script '<!DOCTYPE html>

Another snippet I have has an inline text response:

map $ssl_server_name $canonical_host {
    		""       "prusa.net";
    		default  $ssl_server_name;
	}
location = /.well-known/security.txt {
    default_type text/plain;
    return 200
"Contact: mailto:security@prusa.net
Expires: 2028-02-16T00:00:00.000Z
Preferred-Languages: en, cs
Canonical: https://$canonical_host/.well-known/security.txt
Bug-Bounty: False
";
}

Which prints [variable] INFO Can't find variable 'canonical_host' in script 'Contact: mailto:security@prusa.net

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions