I coincidentally already have a commit that does just this (I wanted this for CSW, but it is the same thing):

https://github.com/geoserver/geoserver/pull/3713

On 09/08/2019 20:32, Jody Garnett wrote:
As an alternative to a debugger adding log statements into the code can also help.
--
Jody Garnett


On Thu, 8 Aug 2019 at 01:59, Paul Wittle <paul.wit...@dorsetcouncil.gov.uk <mailto:paul.wit...@dorsetcouncil.gov.uk>> wrote:

    Hi Jody,

    Thank you for this I will have a look again and see if I can work
    out how to build a local copy to test…unfortunately that is the
    bit that I’ve been struggling with on a Windows machine and with
    my level of Java experience.

    As a quick side note I should say that when I used the proxy base
    URL I was using ${X-Forwarded-Host} as we access the server via a
    number of domains. It may be this that cased the port to still be
    present but I will investigate further.

    Thanks,

    Paul

    *From:*Jody Garnett <jody.garn...@gmail.com
    <mailto:jody.garn...@gmail.com>>
    *Sent:* 06 August 2019 00:06
    *To:* Paul Wittle <p.wit...@dorsetcc.gov.uk
    <mailto:p.wit...@dorsetcc.gov.uk>>
    *Cc:* Geoserver-devel <geoserver-devel@lists.sourceforge.net
    <mailto:geoserver-devel@lists.sourceforge.net>>
    *Subject:* Re: [Geoserver-devel] Port numbers in GetCapabilities

    Your reading of that code seems fine, however I am not sure
    exactly where the proxy base URL is substituted in - I would
    expect it to act as an override. If you want to put some logic to
    ignore the HTTP port 80 or HTTPS port 443 that should be fine.

    Looks proxy base is applied as a URL Mangler (what a great name)
    here
    
https://github.com/geoserver/geoserver/blob/master/src/main/src/main/java/org/geoserver/ows/ProxifyingURLMangler.java

    Can you put a breakpoint in that code and determine if it is being
    used correctly? It may offer you a faster workaround.

    --

    Jody Garnett

    On Fri, 2 Aug 2019 at 07:49, Paul Wittle
    <paul.wit...@dorsetcouncil.gov.uk
    <mailto:paul.wit...@dorsetcouncil.gov.uk>> wrote:

        Hi,

        Would anyone be able to confirm that my reading of the source
        code is correct for me?

        I want to be able to exclude the port number from my URLs in a
        GetCapabilities request (although I’m happy to make that
        conditional on there being a Proxy Base URL if that is
        better). I think I’ve tracked down the bit of the source code
        which constructs the baseURL in the GetCapabilities files and
        my reading is that the port is indeed always present.

        
https://github.com/geoserver/geoserver/blob/master/src/ows/src/main/java/org/geoserver/ows/util/ResponseUtils.java#L415

        I’m assuming that the proxy base URL has already been set as
        req.setServerName() by the time you reach line 414 so I can’t
        see any obvious way that any if/then logic could be put in
        that function without making other changes (of course I’m just
        talking about in a testing fork on my own profile or something
        like that not the real repo).

        I’ve still not managed to find the time to learn how to
        compile a local copy on Windows which is why I thought I’d
        just email as I expect people on this list will be able to
        just confirm that my understanding is right or wrong in
        seconds without the need to build a test.

        Thanks in advance,

        Paul

        This e-mail and any files transmitted with it are intended
        solely for the use of the individual or entity to whom they
        are addressed. It may contain unclassified but sensitive or
        protectively marked material and should be handled
        accordingly. Unless you are the named addressee (or authorised
        to receive it for the addressee) you may not copy or use it,
        or disclose it to anyone else. If you have received this
        transmission in error please notify the sender immediately.
        All traffic may be subject to recording and/or monitoring in
        accordance with relevant legislation. Any views expressed in
        this message are those of the individual sender, except where
        the sender specifies and with authority, states them to be the
        views of Dorset Council. Dorset Council does not accept
        service of documents by fax or other electronic means. Virus
        checking: Whilst all reasonable steps have been taken to
        ensure that this electronic communication and its attachments
        whether encoded, encrypted or otherwise supplied are free from
        computer viruses, Dorset Council accepts no liability in
        respect of any loss, cost, damage or expense suffered as a
        result of accessing this message or any of its attachments.
        For information on how Dorset Council processes your
        information, please see www.dorsetcouncil.gov.uk/416433
        <http://www.dorsetcouncil.gov.uk/416433>

        _______________________________________________
        Geoserver-devel mailing list
        Geoserver-devel@lists.sourceforge.net
        <mailto:Geoserver-devel@lists.sourceforge.net>
        https://lists.sourceforge.net/lists/listinfo/geoserver-devel

    This e-mail and any files transmitted with it are intended solely
    for the use of the individual or entity to whom they are
    addressed. It may contain unclassified but sensitive or
    protectively marked material and should be handled accordingly.
    Unless you are the named addressee (or authorised to receive it
    for the addressee) you may not copy or use it, or disclose it to
    anyone else. If you have received this transmission in error
    please notify the sender immediately. All traffic may be subject
    to recording and/or monitoring in accordance with relevant
    legislation. Any views expressed in this message are those of the
    individual sender, except where the sender specifies and with
    authority, states them to be the views of Dorset Council. Dorset
    Council does not accept service of documents by fax or other
    electronic means. Virus checking: Whilst all reasonable steps have
    been taken to ensure that this electronic communication and its
    attachments whether encoded, encrypted or otherwise supplied are
    free from computer viruses, Dorset Council accepts no liability in
    respect of any loss, cost, damage or expense suffered as a result
    of accessing this message or any of its attachments. For
    information on how Dorset Council processes your information,
    please see www.dorsetcouncil.gov.uk/416433
    <http://www.dorsetcouncil.gov.uk/416433>



_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to