Skip to content

Add more safe META constants to expose those to custom scripts #13542

@carsten-AEI

Description

@carsten-AEI

NetBox version

v3.5.8

Feature type

Change to existing functionality

Proposed functionality

Add HTTP_X_FORWARDED_HOST, HTTP_X_FORWARDED_PROTO and HTTP_X_REAL_IP to HTTP_REQUEST_META_SAFE_COPY allow custom scripts access to.these.

Use case

I was running a simple custom script but needed to rely on HTTP_REFERER to infer how the script was being called to generate valid links in the response of the script. @candlerb meant in #13527 that he would not recommend it.

Long story short, after some debugging it seems best to add HTTP_X_FORWARDED_HOST, HTTP_X_FORWARDED_PROTO and HTTP_X_REAL_IP to HTTP_REQUEST_META_SAFE_COPY to allow custom scripts to use those as well.

Without this, HTTP_HOST would only show the address gunicorn was listening to.

Database changes

./.

External dependencies

./.

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions