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

401 Unauthorized when use Mountebank to mock outer API with NTLM authorization #473

Open
Glazz87 opened this issue Oct 19, 2019 · 0 comments

Comments

@Glazz87
Copy link

Glazz87 commented Oct 19, 2019

I want to mock external API which has NTLM authorization. When I make a request directly to this API (via Postman) everything is ok, responce has correct body and status 200. But if I make request through Mountebank (in proxyTransparent mode) I have 401 Unauthorized.

OS         : Windows Server 2012 R2
mountebank : 2.1.2
node.js    : 10.10.0
Installation method : npm

Log contents in mb.log when running mb --loglevel debug

{"message":"[https:44001 ms_project] ::1:56064 ESTABLISHED","level":"debug","timestamp":"2019-10-19T20:13:32.660Z"}
{"message":"[https:44001 ms_project] ::1:56065 ESTABLISHED","level":"debug","timestamp":"2019-10-19T20:13:32.669Z"}
{"message":"[https:44001 ms_project] ::1:56064 CLOSED","level":"debug","timestamp":"2019-10-19T20:13:32.672Z"}
{"message":"[https:44001 ms_project] ::1:56065 => GET /PWA/_api/ProjectServer/Projects(%27d65f539c-347c-e711-a375-38d5477bf296%27)/includeCustomFields","level":"info","timestamp":"2019-10-19T20:13:32.695Z"}
{"message":"[https:44001 ms_project] ::1:56065 => {'requestFrom':'::1:56065','method':'GET','path':'/PWA/_api/ProjectServer/Projects(%27d65f539c-347c-e711-a375-38d5477bf296%27)/includeCustomFields','query':{},'headers':{'User-Agent':'PostmanRuntime/7.18.0','Accept':'*/*','Host':'localhost:44001','Accept-Encoding':'gzip, deflate','Connection':'keep-alive'},'body':'','ip':'::1'}","level":"debug","timestamp":"2019-10-19T20:13:32.709Z"}
{"message":"[https:44001 ms_project] using predicate match: {}","level":"debug","timestamp":"2019-10-19T20:13:32.710Z"}
{"message":"[https:44001 ms_project] generating response from {'proxy':{'to':'https://api.outer-service.com','mode':'proxyTransparent'}}","level":"debug","timestamp":"2019-10-19T20:13:32.711Z"}
{"message":"[https:44001 ms_project] Proxy ::1:56065 => {'requestFrom':'::1:56065','method':'GET','path':'/PWA/_api/ProjectServer/Projects(%27d65f539c-347c-e711-a375-38d5477bf296%27)/includeCustomFields','query':{},'headers':{'User-Agent':'PostmanRuntime/7.18.0','Accept':'*/*','Host':'localhost:44001','Accept-Encoding':'gzip, deflate','Connection':'keep-alive'},'body':'','ip':'::1'} => https://api.outer-service.com","level":"debug","timestamp":"2019-10-19T20:13:32.757Z"}
{"message":"[https:44001 ms_project] Proxy ::1:56065 <= {'statusCode':401,'headers':{'Content-Type':'text/plain; charset=utf-8','Server':'Microsoft-IIS/8.5','SPRequestGuid':'c57d0f9f-cdc2-d0d9-c3a5-2767a7a326f1','request-id':'c57d0f9f-cdc2-d0d9-c3a5-2767a7a326f1','X-FRAME-OPTIONS':'SAMEORIGIN','SPRequestDuration':'4','SPIisLatency':'1','WWW-Authenticate':'NTLM','X-Powered-By':'ASP.NET','MicrosoftSharePointTeamServices':'15.0.0.4859','X-Content-Type-Options':'nosniff','X-MS-InvokeApp':'1; RequireReadOnly','Date':'Sat, 19 Oct 2019 20:22:28 GMT','Content-Length':'16'},'body':'401 UNAUTHORIZED','_mode':'text'} <= https://api.outer-service.com","level":"debug","timestamp":"2019-10-19T20:13:33.965Z"}
{"message":"[https:44001 ms_project] ::1:56065 <= {'statusCode':401,'headers':{'Content-Type':'text/plain; charset=utf-8','Server':'Microsoft-IIS/8.5','SPRequestGuid':'c57d0f9f-cdc2-d0d9-c3a5-2767a7a326f1','request-id':'c57d0f9f-cdc2-d0d9-c3a5-2767a7a326f1','X-FRAME-OPTIONS':'SAMEORIGIN','SPRequestDuration':'4','SPIisLatency':'1','WWW-Authenticate':'NTLM','X-Powered-By':'ASP.NET','MicrosoftSharePointTeamServices':'15.0.0.4859','X-Content-Type-Options':'nosniff','X-MS-InvokeApp':'1; RequireReadOnly','Date':'Sat, 19 Oct 2019 20:22:28 GMT','Content-Length':16,'Connection':'close'},'body':'401 UNAUTHORIZED','_mode':'text'}","level":"debug","timestamp":"2019-10-19T20:13:33.969Z"}
{"message":"[https:44001 ms_project] ::1:56065 CLOSED","level":"debug","timestamp":"2019-10-19T20:13:33.974Z"}
{"message":"[https:44001 ms_project] ::1:56067 ESTABLISHED","level":"debug","timestamp":"2019-10-19T20:13:33.989Z"}
{"message":"[https:44001 ms_project] ::1:56068 ESTABLISHED","level":"debug","timestamp":"2019-10-19T20:13:33.991Z"}
{"message":"[https:44001 ms_project] ::1:56067 CLOSED","level":"debug","timestamp":"2019-10-19T20:13:33.992Z"}
{"message":"[https:44001 ms_project] ::1:56068 => GET /PWA/_api/ProjectServer/Projects(%27d65f539c-347c-e711-a375-38d5477bf296%27)/includeCustomFields","level":"info","timestamp":"2019-10-19T20:13:33.995Z"}
{"message":"[https:44001 ms_project] ::1:56068 => {'requestFrom':'::1:56068','method':'GET','path':'/PWA/_api/ProjectServer/Projects(%27d65f539c-347c-e711-a375-38d5477bf296%27)/includeCustomFields','query':{},'headers':{'User-Agent':'PostmanRuntime/7.18.0','Accept':'*/*','Host':'localhost:44001','Accept-Encoding':'gzip, deflate','Connection':'keep-alive','Authorization':'NTLM TlRMTVNTUAABAAAAB6IIogAAAAAoAAAAAAAAACgAAAAFASgKAAAADw=='},'body':'','ip':'::1'}","level":"debug","timestamp":"2019-10-19T20:13:33.999Z"}
{"message":"[https:44001 ms_project] using predicate match: {}","level":"debug","timestamp":"2019-10-19T20:13:34.000Z"}
{"message":"[https:44001 ms_project] generating response from {'proxy':{'to':'https://api.outer-service.com','mode':'proxyTransparent'}}","level":"debug","timestamp":"2019-10-19T20:13:34.002Z"}
{"message":"[https:44001 ms_project] Proxy ::1:56068 => {'requestFrom':'::1:56068','method':'GET','path':'/PWA/_api/ProjectServer/Projects(%27d65f539c-347c-e711-a375-38d5477bf296%27)/includeCustomFields','query':{},'headers':{'User-Agent':'PostmanRuntime/7.18.0','Accept':'*/*','Host':'localhost:44001','Accept-Encoding':'gzip, deflate','Connection':'keep-alive','Authorization':'NTLM TlRMTVNTUAABAAAAB6IIogAAAAAoAAAAAAAAACgAAAAFASgKAAAADw=='},'body':'','ip':'::1'} => https://api.outer-service.com","level":"debug","timestamp":"2019-10-19T20:13:34.008Z"}
{"message":"[https:44001 ms_project] Proxy ::1:56068 <= {'statusCode':401,'headers':{'Server':'Microsoft-IIS/8.5','WWW-Authenticate':'NTLM TlRMTVNTUAACAAAACAAIADgAAAAFgomiOknQCZJkLIIAAAAAAAAAAIwAjABAAAAABgOAJQAAAA9EAE0ARgBTAAIACABEAE0ARgBTAAEAGgBNAFMASwAwADEALQBWAC0AVwBFAEIAMAA0AAQADgBEAG0AZgBzAC4AcgB1AAMAKgBNAFMASwAwADEALQBWAC0AVwBFAEIAMAA0AC4AZABtAGYAcwAuAHIAdQAFAA4ARABtAGYAcwAuAHIAdQAHAAgAtXgy7rqG1QEAAAAA','SPRequestGuid':'c67d0f9f-ad1b-d0d9-c3a5-23cd2f20f48f','request-id':'c67d0f9f-ad1b-d0d9-c3a5-23cd2f20f48f','X-FRAME-OPTIONS':'SAMEORIGIN','SPRequestDuration':'1','SPIisLatency':'0','X-Powered-By':'ASP.NET','MicrosoftSharePointTeamServices':'15.0.0.4859','X-Content-Type-Options':'nosniff','X-MS-InvokeApp':'1; RequireReadOnly','Date':'Sat, 19 Oct 2019 20:22:29 GMT','Content-Length':'0'},'body':'','_mode':'text'} <= https://api.outer-service.com","level":"debug","timestamp":"2019-10-19T20:13:35.385Z"}
{"message":"[https:44001 ms_project] ::1:56068 <= {'statusCode':401,'headers':{'Server':'Microsoft-IIS/8.5','WWW-Authenticate':'NTLM TlRMTVNTUAACAAAACAAIADgAAAAFgomiOknQCZJkLIIAAAAAAAAAAIwAjABAAAAABgOAJQAAAA9EAE0ARgBTAAIACABEAE0ARgBTAAEAGgBNAFMASwAwADEALQBWAC0AVwBFAEIAMAA0AAQADgBEAG0AZgBzAC4AcgB1AAMAKgBNAFMASwAwADEALQBWAC0AVwBFAEIAMAA0AC4AZABtAGYAcwAuAHIAdQAFAA4ARABtAGYAcwAuAHIAdQAHAAgAtXgy7rqG1QEAAAAA','SPRequestGuid':'c67d0f9f-ad1b-d0d9-c3a5-23cd2f20f48f','request-id':'c67d0f9f-ad1b-d0d9-c3a5-23cd2f20f48f','X-FRAME-OPTIONS':'SAMEORIGIN','SPRequestDuration':'1','SPIisLatency':'0','X-Powered-By':'ASP.NET','MicrosoftSharePointTeamServices':'15.0.0.4859','X-Content-Type-Options':'nosniff','X-MS-InvokeApp':'1; RequireReadOnly','Date':'Sat, 19 Oct 2019 20:22:29 GMT','Content-Length':0,'Connection':'close'},'body':'','_mode':'text'}","level":"debug","timestamp":"2019-10-19T20:13:35.413Z"}
{"message":"[https:44001 ms_project] ::1:56068 CLOSED","level":"debug","timestamp":"2019-10-19T20:13:35.420Z"}
{"message":"[https:44001 ms_project] ::1:56070 ESTABLISHED","level":"debug","timestamp":"2019-10-19T20:13:35.422Z"}
{"message":"[https:44001 ms_project] ::1:56071 ESTABLISHED","level":"debug","timestamp":"2019-10-19T20:13:35.424Z"}
{"message":"[https:44001 ms_project] ::1:56070 CLOSED","level":"debug","timestamp":"2019-10-19T20:13:35.426Z"}
{"message":"[https:44001 ms_project] ::1:56071 => GET /PWA/_api/ProjectServer/Projects(%27d65f539c-347c-e711-a375-38d5477bf296%27)/includeCustomFields","level":"info","timestamp":"2019-10-19T20:13:35.429Z"}
{"message":"[https:44001 ms_project] ::1:56071 => {'requestFrom':'::1:56071','method':'GET','path':'/PWA/_api/ProjectServer/Projects(%27d65f539c-347c-e711-a375-38d5477bf296%27)/includeCustomFields','query':{},'headers':{'User-Agent':'PostmanRuntime/7.18.0','Accept':'*/*','Host':'localhost:44001','Accept-Encoding':'gzip, deflate','Connection':'keep-alive','Authorization':'NTLM TlRMTVNTUAADAAAAGAAYAGgAAAAYABgAgAAAAAAAAABIAAAAIAAgAEgAAAAAAAAAaAAAAAAAAACYAAAABYKIogUBKAoAAAAPbQBzAGsAMAAxAC0AYQBzAC0AaQBzAHUAcABfAHAAcwChXckKKObIAgAAAAAAAAAAAAAAAAAAAAC7J28tpUODuPWVM46z4l6jNCxcZTO/IfU='},'body':'','ip':'::1'}","level":"debug","timestamp":"2019-10-19T20:13:35.433Z"}
{"message":"[https:44001 ms_project] using predicate match: {}","level":"debug","timestamp":"2019-10-19T20:13:35.434Z"}
{"message":"[https:44001 ms_project] generating response from {'proxy':{'to':'https://api.outer-service.com','mode':'proxyTransparent'}}","level":"debug","timestamp":"2019-10-19T20:13:35.435Z"}
{"message":"[https:44001 ms_project] Proxy ::1:56071 => {'requestFrom':'::1:56071','method':'GET','path':'/PWA/_api/ProjectServer/Projects(%27d65f539c-347c-e711-a375-38d5477bf296%27)/includeCustomFields','query':{},'headers':{'User-Agent':'PostmanRuntime/7.18.0','Accept':'*/*','Host':'localhost:44001','Accept-Encoding':'gzip, deflate','Connection':'keep-alive','Authorization':'NTLM TlRMTVNTUAADAAAAGAAYAGgAAAAYABgAgAAAAAAAAABIAAAAIAAgAEgAAAAAAAAAaAAAAAAAAACYAAAABYKIogUBKAoAAAAPbQBzAGsAMAAxAC0AYQBzAC0AaQBzAHUAcABfAHAAcwChXckKKObIAgAAAAAAAAAAAAAAAAAAAAC7J28tpUODuPWVM46z4l6jNCxcZTO/IfU='},'body':'','ip':'::1'} => https://api.outer-service.com","level":"debug","timestamp":"2019-10-19T20:13:35.441Z"}
{"message":"[https:44001 ms_project] Proxy ::1:56071 <= {'statusCode':401,'headers':{'Server':'Microsoft-IIS/8.5','SPRequestGuid':'c67d0f9f-6d25-d0d9-c3a5-2018e00fb5af','request-id':'c67d0f9f-6d25-d0d9-c3a5-2018e00fb5af','X-FRAME-OPTIONS':'SAMEORIGIN','SPRequestDuration':'1','SPIisLatency':'0','WWW-Authenticate':'NTLM','X-Powered-By':'ASP.NET','MicrosoftSharePointTeamServices':'15.0.0.4859','X-Content-Type-Options':'nosniff','X-MS-InvokeApp':'1; RequireReadOnly','Date':'Sat, 19 Oct 2019 20:22:29 GMT','Content-Length':'0'},'body':'','_mode':'text'} <= https://api.outer-service.com","level":"debug","timestamp":"2019-10-19T20:13:35.541Z"}
{"message":"[https:44001 ms_project] ::1:56071 <= {'statusCode':401,'headers':{'Server':'Microsoft-IIS/8.5','SPRequestGuid':'c67d0f9f-6d25-d0d9-c3a5-2018e00fb5af','request-id':'c67d0f9f-6d25-d0d9-c3a5-2018e00fb5af','X-FRAME-OPTIONS':'SAMEORIGIN','SPRequestDuration':'1','SPIisLatency':'0','WWW-Authenticate':'NTLM','X-Powered-By':'ASP.NET','MicrosoftSharePointTeamServices':'15.0.0.4859','X-Content-Type-Options':'nosniff','X-MS-InvokeApp':'1; RequireReadOnly','Date':'Sat, 19 Oct 2019 20:22:29 GMT','Content-Length':0,'Connection':'close'},'body':'','_mode':'text'}","level":"debug","timestamp":"2019-10-19T20:13:35.557Z"}
{"message":"[https:44001 ms_project] ::1:56071 CLOSED","level":"debug","timestamp":"2019-10-19T20:13:35.560Z"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants