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

Question: How to run broker behind sub-path? #733

Closed
tharwan opened this issue Nov 11, 2024 · 1 comment
Closed

Question: How to run broker behind sub-path? #733

tharwan opened this issue Nov 11, 2024 · 1 comment

Comments

@tharwan
Copy link

tharwan commented Nov 11, 2024

Hi, what are the correct options to use when running Pact Broker behind as sub-path like https://internal.domain/pact?

I assume we need something uri rewrite in the reverse proxy like ^/pact/(*) to $1.

But I could not figure out what exactly to set for X-Forwarded-Host and baseUrl.

Adding to my confusion, I set

    httpDebugLoggingEnabled: true
    logLevel: debug

but I can not see any access attempts I make, only the heartbeats:

2024-11-11T10:25:44+01:00 2024-11-11 09:25:44.459929 D [8:puma srv tp 002] PactBroker::Api::Middleware::HttpDebugLogs -- env -- {"SCRIPT_NAME"=>"", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"puma 5.6.9 Birdie's Version", "GATEWAY_INTERFACE"=>"CGI/1.2", "REQUEST_METHOD"=>"GET", "REQUEST_PATH"=>"/diagnostic/status/heartbeat", "REQUEST_URI"=>"/diagnostic/status/heartbeat", "HTTP_VERSION"=>"HTTP/1.1", "HTTP_HOST"=>"10.60.2.197:9292", "HTTP_USER_AGENT"=>"kube-probe/1.26", "HTTP_ACCEPT"=>"*/*", "HTTP_CONNECTION"=>"close", "SERVER_NAME"=>"10.60.2.197", "SERVER_PORT"=>"9292", "PATH_INFO"=>"/diagnostic/status/heartbeat", "REMOTE_ADDR"=>"10.61.1.71", "rack.input"=>""}

2024-11-11T10:25:44+01:00 2024-11-11 09:25:44.460967 D [8:puma srv tp 002] PactBroker::Api::Middleware::HttpDebugLogs -- response -- {"status"=>200, "headers"=>{"Vary"=>"Accept", "Cache-Control"=>"no-cache", "Content-Type"=>"application/hal+json", "Content-Length"=>"95", "Date"=>"Mon, 11 Nov 2024 09:25:44 GMT", "Server"=>"Webmachine-Ruby/2.0.1 Rack/1.3", "X-Pact-Broker-Version"=>"2.112.0", "X-Content-Type-Options"=>"nosniff"}, "body"=>["{\"ok\":true,\"_links\":{\"self\":{\"href\":\"internal.domain/pact//diagnostic/status/heartbeat\"}}}"]}

I noticed that in the response log the href appears to be almost correct.

However when accessing https://internal.domain/pact/ I get a 404 from ruby:

404 Not Found

The requested document was not found on this server.

Webmachine-Ruby/2.0.1 server

Any help would be very appreciated.

@tharwan
Copy link
Author

tharwan commented Nov 12, 2024

alright, my main problem was that baseUrl needs to include the protocol (https://internal.domain/pact), otherwise the matching does not work correctly

@tharwan tharwan closed this as completed Nov 12, 2024
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