-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Raphael Kabo
committed
Dec 6, 2023
1 parent
af10c85
commit 8d1c654
Showing
3 changed files
with
147 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# NGINX Conf file used by Cypress-Nginx Github actions | ||
# so we can run cypress tests against the local nginx server | ||
# with a ssl cert set on the domain | ||
|
||
#user nobody; | ||
worker_processes 1; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
include mime.types; | ||
default_type application/octet-stream; | ||
|
||
sendfile on; | ||
|
||
keepalive_timeout 65; | ||
|
||
# fixes issues for large response headers | ||
proxy_buffer_size 128k; | ||
proxy_buffers 4 256k; | ||
proxy_busy_buffers_size 256k; | ||
|
||
|
||
# manage.thegulocal.com | ||
# ====================== | ||
server { | ||
listen 443 ssl; | ||
server_name manage.thegulocal.com; | ||
proxy_http_version 1.1; # this is essential for chunked responses to work | ||
|
||
ssl_certificate manage.thegulocal.com.crt; | ||
ssl_certificate_key manage.thegulocal.com.key; | ||
ssl_session_timeout 5m; | ||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | ||
ssl_ciphers HIGH:!aNULL:!MD5; | ||
ssl_prefer_server_ciphers on; | ||
|
||
location / { | ||
proxy_pass http://localhost:9234/; | ||
proxy_set_header Host $http_host; | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "Upgrade"; | ||
} | ||
} | ||
|
||
server { | ||
listen 443 ssl; | ||
server_name profile.thegulocal.com; | ||
proxy_http_version 1.1; # this is essential for chunked responses to work | ||
|
||
ssl_certificate profile.thegulocal.com.crt; | ||
ssl_certificate_key profile.thegulocal.com.key; | ||
ssl_session_timeout 5m; | ||
ssl_protocols TLSv1.2 TLSv1.3; | ||
ssl_ciphers HIGH:!aNULL:!MD5; | ||
ssl_prefer_server_ciphers on; | ||
|
||
# dummy location header for the API | ||
proxy_set_header X-GU-ID-Geolocation ip:$remote_addr,country:GB,city:Leeds; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
|
||
location / { | ||
proxy_pass https://profile.code.dev-theguardian.com; | ||
proxy_next_upstream error timeout http_404 non_idempotent; | ||
proxy_set_header "X-Forwarded-Proto" "https"; | ||
proxy_set_header "X-GU-Okta-Env" "profile.code.dev-theguardian.com"; | ||
proxy_set_header Host profile.code.dev-theguardian.com; | ||
proxy_set_header Origin https://profile.code.dev-theguardian.com; | ||
proxy_set_header Accept-Encoding ""; | ||
proxy_hide_header Content-Security-Policy; | ||
|
||
proxy_cookie_domain profile.code.dev-theguardian.com profile.thegulocal.com; | ||
proxy_cookie_domain .code.dev-theguardian.com .thegulocal.com; | ||
|
||
sub_filter_types application/json; | ||
sub_filter_once off; | ||
sub_filter 'profile.code.dev-theguardian.com' 'profile.thegulocal.com'; | ||
|
||
###### | ||
# remove `sid` cookie in requests to Gateway | ||
# save original "Cookie" header value | ||
set $altered_cookie $http_cookie; | ||
# check if the "sid" cookie is present | ||
if ($http_cookie ~ '(.*)(^|;\s)sid=("[^"]*"|[^\s]*[^;]?)(\2|$|;$)(?:;\s)?(.*)') { | ||
# cut "sid" cookie from the string | ||
set $altered_cookie $1$4$5; | ||
} | ||
# hide original "Cookie" header | ||
proxy_hide_header Cookie; | ||
# set "Cookie" header to the new value | ||
proxy_set_header Cookie $altered_cookie; | ||
###### | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters