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

Trying to append a custom header results in strange behavior #2

Closed
masterkain opened this issue Aug 4, 2013 · 2 comments
Closed

Trying to append a custom header results in strange behavior #2

masterkain opened this issue Aug 4, 2013 · 2 comments

Comments

@masterkain
Copy link

I'm trying to intercept and proxy traffic coming from a webview on a specific host. My main goal is to append a custom header to every request coming from the webview.

What I'm observing is that in the first request the token is appended correctly. Now on the weview I tap a normal link, the header doesn't get sent along the request.

However since the user is now not authenticated a redirect happens and in this request for the new page the header value is appended twice separated by a comma.

  [WebViewProxy handleRequestsWithHost:@"myhost" handler:^(NSURLRequest* req, WVPResponse *res) {
    NSMutableURLRequest *request = [req mutableCopy];
    [request addValue:@'mytoken' forHTTPHeaderField:@"AUTH-TOKEN"];
    [NSURLConnection connectionWithRequest:request delegate:res];
  }];
Started GET "/account"
"auth_token"=>"mytoken"
Completed 200 OK in 1305ms (Views: 1244.8ms | ActiveRecord: 39.3ms)
...
Started GET "/account/edit"
*no auth token sent*
Completed 401 Unauthorized in 4ms
...
Started GET "/account/sign_in"
"auth_token"=>"mytoken,mytoken"
Completed 200 OK in 80ms (Views: 72.5ms | ActiveRecord: 0.0ms)
@masterkain
Copy link
Author

Also I saw a podspec added 7 months ago, but I can't see it in master. Thanks for this library!

@marcuswestin
Copy link
Owner

Hey @masterkain, I was out of the country on vacation. Sorry about that. Did you figure out your issue?

marcuswestin pushed a commit that referenced this issue Feb 14, 2015
Add podspec file. GH Issues: fix #1 and fix #3
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

2 participants